]> git.karo-electronics.de Git - linux-beck.git/commit
cgroup: make cgroup_file_open() rcu_read_lock() around cgroup_css() and add cfent...
authorTejun Heo <tj@kernel.org>
Tue, 13 Aug 2013 15:01:55 +0000 (11:01 -0400)
committerTejun Heo <tj@kernel.org>
Tue, 13 Aug 2013 15:01:55 +0000 (11:01 -0400)
commit105347ba5da3e87facce2337c50cd5df93cc6bec
treec2f65ed8387a08004ac6dafb38bbaa294dd3900d
parentb77d7b6088377998ebf65eaea5e51008c2d75e94
cgroup: make cgroup_file_open() rcu_read_lock() around cgroup_css() and add cfent->css

For the planned unified hierarchy, each css (cgroup_subsys_state) will
be RCU protected so that it can be created and destroyed individually
while allowing RCU accesses, and cgroup_css() will soon require either
holding cgroup_mutex or RCU read lock.

This patch updates cgroup_file_open() such that it acquires the
associated css under rcu_read_lock().  While cgroup_file_css() usages
in other file operations are safe due to the reference from open,
cgroup_css() wouldn't know that and will still trigger warnings.  It'd
be cleanest to store the acquired css in file->prvidate_data for
further file operations but that's already used by seqfile.  This
patch instead adds cfent->css to cache the associated css.  Note that
while this field is initialized during cfe init, it should only be
considered valid while the file is open.

This patch doesn't change visible behavior.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
kernel/cgroup.c