From: Gao feng Subject: [PATCH 1/2] cgroup: use cgroup_addrm_files in cgroup_clear_directory Date: Sat, 1 Dec 2012 00:21:28 +0800 Message-ID: <1354292489-18434-1-git-send-email-gaofeng@cn.fujitsu.com> Return-path: Sender: cgroups-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Cc: tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, Gao feng cgroup_rm_file only remove the first file. after remount, the cgroup subsystem will be unloaded with it's files left. use cgroup_addrm_files to remove all files of subsystem. Signed-off-by: Gao feng --- kernel/cgroup.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/kernel/cgroup.c b/kernel/cgroup.c index f24f724..e5233b7 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -970,6 +970,8 @@ static int cgroup_rm_file(struct cgroup *cgrp, const struct cftype *cft) return -ENOENT; } +static int cgroup_addrm_files(struct cgroup *cgrp, struct cgroup_subsys *subsys, + struct cftype cfts[], bool is_add); /** * cgroup_clear_directory - selective removal of base and subsystem files * @dir: directory containing the files @@ -987,7 +989,7 @@ static void cgroup_clear_directory(struct dentry *dir, bool base_files, if (!test_bit(ss->subsys_id, &subsys_mask)) continue; list_for_each_entry(set, &ss->cftsets, node) - cgroup_rm_file(cgrp, set->cfts); + cgroup_addrm_files(cgrp, NULL, set->cfts, false); } if (base_files) { while (!list_empty(&cgrp->files)) -- 1.7.7.6