From: Tejun Heo <tj@kernel.org>
To: Gao feng <gaofeng@cn.fujitsu.com>
Cc: cgroups@vger.kernel.org, lizefan@huawei.com,
linux-kernel@vger.kernel.org,
containers@lists.linux-foundation.org
Subject: [PATCH] cgroup: use cgroup_addrm_files() in cgroup_clear_directory()
Date: Fri, 30 Nov 2012 11:47:20 -0800 [thread overview]
Message-ID: <20121130194720.GG3873@htj.dyndns.org> (raw)
In-Reply-To: <1354292489-18434-1-git-send-email-gaofeng@cn.fujitsu.com>
>From 879a3d9dbbde823ac77d39131e7a287f31b8296f Mon Sep 17 00:00:00 2001
From: Gao feng <gaofeng@cn.fujitsu.com>
Date: Sat, 1 Dec 2012 00:21:28 +0800
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>
---
Applied to cgroup/for-3.8 with minor updates. Thanks!
kernel/cgroup.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index b186a7e..e1293a9 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -246,6 +246,8 @@ static DEFINE_SPINLOCK(hierarchy_id_lock);
static int need_forkexit_callback __read_mostly;
static int cgroup_destroy_locked(struct cgroup *cgrp);
+static int cgroup_addrm_files(struct cgroup *cgrp, struct cgroup_subsys *subsys,
+ struct cftype cfts[], bool is_add);
#ifdef CONFIG_PROVE_LOCKING
int cgroup_lock_is_held(void)
@@ -964,7 +966,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.11.7
prev parent reply other threads:[~2012-11-30 19:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-30 16:21 [PATCH 1/2] cgroup: use cgroup_addrm_files in cgroup_clear_directory Gao feng
2012-11-30 16:21 ` [PATCH 2/2] cgroup: remove subsystem files when remounting cgroup Gao feng
2012-11-30 19:27 ` Tejun Heo
2012-12-03 0:45 ` Gao feng
2012-12-03 1:28 ` [PATCH RESEND] " Gao feng
2012-12-03 16:34 ` Tejun Heo
2012-11-30 19:47 ` Tejun Heo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121130194720.GG3873@htj.dyndns.org \
--to=tj@kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=containers@lists.linux-foundation.org \
--cc=gaofeng@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).