[PATCH v2 4/4] cpuset: Hold callback_mutex in cpuset_clone()

From: Li Zefan
Date: Thu Feb 24 2011 - 01:56:11 EST

Chaning cpuset->mems/cpuset->cpus should be protected under

cpuset_post_clone() doesn't follow this rule. It's ok because it's
called when creating/initializing a cgroup, but we'd better
hold the lock to avoid subtil break in the future.

Acked-by: Paul Menage <menage@xxxxxxxxxx>
Acked-by: David Rientjes <rientjes@xxxxxxxxxx>
Signed-off-by: Li Zefan <lizf@xxxxxxxxxxxxxx>
kernel/cpuset.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 3f93e5a..1ca786a 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1836,8 +1836,10 @@ static void cpuset_post_clone(struct cgroup_subsys *ss,
cs = cgroup_cs(cgroup);
parent_cs = cgroup_cs(parent);

+ mutex_lock(&callback_mutex);
cs->mems_allowed = parent_cs->mems_allowed;
cpumask_copy(cs->cpus_allowed, parent_cs->cpus_allowed);
+ mutex_unlock(&callback_mutex);

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/