diff options
author | Tejun Heo <tj@kernel.org> | 2012-11-19 11:13:36 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2012-11-19 11:13:36 -0500 |
commit | 648bb56d076bde31113f09a7d24d95bc8d4155ac (patch) | |
tree | 5e17d543a77f3783e4cfce7f525f4c3255238c07 /kernel/cgroup.c | |
parent | b48c6a80a0f7584056f768268fc12b87745a393f (diff) |
cgroup: lock cgroup_mutex in cgroup_init_subsys()
Make cgroup_init_subsys() grab cgroup_mutex while initializing a
subsystem so that all helpers and callbacks are called under the
context they expect. This isn't strictly necessary as
cgroup_init_subsys() doesn't race with anybody but will allow adding
lockdep assertions.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r-- | kernel/cgroup.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 6cc693b91c4a..09751657abdc 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -4317,6 +4317,8 @@ static void __init cgroup_init_subsys(struct cgroup_subsys *ss) | |||
4317 | 4317 | ||
4318 | printk(KERN_INFO "Initializing cgroup subsys %s\n", ss->name); | 4318 | printk(KERN_INFO "Initializing cgroup subsys %s\n", ss->name); |
4319 | 4319 | ||
4320 | mutex_lock(&cgroup_mutex); | ||
4321 | |||
4320 | /* init base cftset */ | 4322 | /* init base cftset */ |
4321 | cgroup_init_cftsets(ss); | 4323 | cgroup_init_cftsets(ss); |
4322 | 4324 | ||
@@ -4346,6 +4348,8 @@ static void __init cgroup_init_subsys(struct cgroup_subsys *ss) | |||
4346 | if (ss->post_create) | 4348 | if (ss->post_create) |
4347 | ss->post_create(dummytop); | 4349 | ss->post_create(dummytop); |
4348 | 4350 | ||
4351 | mutex_unlock(&cgroup_mutex); | ||
4352 | |||
4349 | /* this function shouldn't be used with modular subsystems, since they | 4353 | /* this function shouldn't be used with modular subsystems, since they |
4350 | * need to register a subsys_id, among other things */ | 4354 | * need to register a subsys_id, among other things */ |
4351 | BUG_ON(ss->module); | 4355 | BUG_ON(ss->module); |