diff options
author | Gao feng <gaofeng@cn.fujitsu.com> | 2012-11-30 11:21:28 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2012-11-30 14:44:12 -0500 |
commit | 879a3d9dbbde823ac77d39131e7a287f31b8296f (patch) | |
tree | 081a858a5d37325fc3210180c34c1f79efbdfbae /kernel | |
parent | 1f869e8711d18aaf6e2979922bc9377ad394b82f (diff) |
cgroup: use cgroup_addrm_files() in cgroup_clear_directory()
cgroup_clear_directory() incorrectly invokes cgroup_rm_file() on each
cftset of the target subsystems, which only removes the first file of
each set. This leaves dangling files after subsystems are removed
from a cgroup root via remount.
Use cgroup_addrm_files() to remove all files of target subsystems.
tj: Move cgroup_addrm_files() prototype decl upwards next to other
global declarations. Commit message updated.
Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/cgroup.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index b186a7e25b0a..e1293a9189b6 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -246,6 +246,8 @@ static DEFINE_SPINLOCK(hierarchy_id_lock); | |||
246 | static int need_forkexit_callback __read_mostly; | 246 | static int need_forkexit_callback __read_mostly; |
247 | 247 | ||
248 | static int cgroup_destroy_locked(struct cgroup *cgrp); | 248 | static int cgroup_destroy_locked(struct cgroup *cgrp); |
249 | static int cgroup_addrm_files(struct cgroup *cgrp, struct cgroup_subsys *subsys, | ||
250 | struct cftype cfts[], bool is_add); | ||
249 | 251 | ||
250 | #ifdef CONFIG_PROVE_LOCKING | 252 | #ifdef CONFIG_PROVE_LOCKING |
251 | int cgroup_lock_is_held(void) | 253 | int cgroup_lock_is_held(void) |
@@ -964,7 +966,7 @@ static void cgroup_clear_directory(struct dentry *dir, bool base_files, | |||
964 | if (!test_bit(ss->subsys_id, &subsys_mask)) | 966 | if (!test_bit(ss->subsys_id, &subsys_mask)) |
965 | continue; | 967 | continue; |
966 | list_for_each_entry(set, &ss->cftsets, node) | 968 | list_for_each_entry(set, &ss->cftsets, node) |
967 | cgroup_rm_file(cgrp, set->cfts); | 969 | cgroup_addrm_files(cgrp, NULL, set->cfts, false); |
968 | } | 970 | } |
969 | if (base_files) { | 971 | if (base_files) { |
970 | while (!list_empty(&cgrp->files)) | 972 | while (!list_empty(&cgrp->files)) |