]> git.baikalelectronics.ru Git - kernel.git/commit
cgroup: pin cgroup_subsys_state when opening a cgroupfs file
authorTejun Heo <tj@kernel.org>
Fri, 9 Aug 2013 00:11:23 +0000 (20:11 -0400)
committerTejun Heo <tj@kernel.org>
Fri, 9 Aug 2013 00:11:23 +0000 (20:11 -0400)
commit8ee1b73926c071bc86ba18817e6d14b542bb3f7d
tree770514a6164e8464caf0b7497bb06c68936febc6
parent1fafd9ce671744dd254e6ed7564b6249a2997494
cgroup: pin cgroup_subsys_state when opening a cgroupfs file

Previously, each file read/write operation relied on the inode
reference count pinning the cgroup and simply checked whether the
cgroup was marked dead before proceeding to invoke the per-subsystem
callback.  This was rather silly as it didn't have any synchronization
or css pinning around the check and the cgroup may be removed and all
css refs drained between the DEAD check and actual method invocation.

This patch pins the css between open() and release() so that it is
guaranteed to be alive for all file operations and remove the silly
DEAD checks from cgroup_file_read/write().

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