aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-06-28 20:07:30 -0400
committerTejun Heo <tj@kernel.org>2013-07-12 15:34:02 -0400
commitf172e67cf9d842bc646d0f66792e38435a334b1e (patch)
tree9d270162713a25dc37d2e10553e93f7a4080d111
parent3126121fb30941552b1a806c7c2e686bde57e270 (diff)
cgroup: move number_of_cgroups test out of rebind_subsystems() into cgroup_remount()
rebind_subsystems() currently fails if the hierarchy has any !root cgroups; however, on the planned unified hierarchy, rebind_subsystems() will be used while populated. Move the test to cgroup_remount(), which is the only place the test is necessary anyway. As it's impossible for the other two callers of rebind_subsystems() to have populated hierarchy, this doesn't make any behavior changes. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Li Zefan <lizefan@huawei.com>
-rw-r--r--kernel/cgroup.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 4ec8d2da94d1..c108d3d1ea30 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1021,13 +1021,6 @@ static int rebind_subsystems(struct cgroupfs_root *root,
1021 } 1021 }
1022 } 1022 }
1023 1023
1024 /* Currently we don't handle adding/removing subsystems when
1025 * any child cgroups exist. This is theoretically supportable
1026 * but involves complex error handling, so it's being left until
1027 * later */
1028 if (root->number_of_cgroups > 1)
1029 return -EBUSY;
1030
1031 ret = cgroup_populate_dir(cgrp, added_mask); 1024 ret = cgroup_populate_dir(cgrp, added_mask);
1032 if (ret) 1025 if (ret)
1033 return ret; 1026 return ret;
@@ -1373,6 +1366,12 @@ static int cgroup_remount(struct super_block *sb, int *flags, char *data)
1373 goto out_unlock; 1366 goto out_unlock;
1374 } 1367 }
1375 1368
1369 /* remounting is not allowed for populated hierarchies */
1370 if (root->number_of_cgroups > 1) {
1371 ret = -EBUSY;
1372 goto out_unlock;
1373 }
1374
1376 ret = rebind_subsystems(root, added_mask, removed_mask); 1375 ret = rebind_subsystems(root, added_mask, removed_mask);
1377 if (ret) 1376 if (ret)
1378 goto out_unlock; 1377 goto out_unlock;