Commit 7fd8c565 authored by Tejun Heo's avatar Tejun Heo

cgroup: update subsystem rebind restrictions

Because the default root couldn't have any non-root csses attached to
it, rebinding away from it was always allowed; however, the default
hierarchy will soon host the unified hierarchy and have non-root csses
so the rebind restrictions need to be updated accordingly.

Instead of special casing rebinding from the default hierarchy and
then checking whether the source hierarchy has children cgroups, which
implies non-root csses for !dfl hierarchies, simply check whether the
source hierarchy has non-root csses for the subsystem using
css_next_child().
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Acked-by: default avatarLi Zefan <lizefan@huawei.com>
parent 6803c006
...@@ -1051,16 +1051,12 @@ static int rebind_subsystems(struct cgroup_root *dst_root, ...@@ -1051,16 +1051,12 @@ static int rebind_subsystems(struct cgroup_root *dst_root,
if (!(ss_mask & (1 << ssid))) if (!(ss_mask & (1 << ssid)))
continue; continue;
/* if @ss is on the dummy_root, we can always move it */ /* if @ss has non-root csses attached to it, can't move */
if (ss->root == &cgrp_dfl_root) if (css_next_child(NULL, cgroup_css(&ss->root->cgrp, ss)))
continue;
/* if @ss has non-root cgroups attached to it, can't move */
if (!list_empty(&ss->root->cgrp.children))
return -EBUSY; return -EBUSY;
/* can't move between two non-dummy roots either */ /* can't move between two non-dummy roots either */
if (dst_root != &cgrp_dfl_root) if (ss->root != &cgrp_dfl_root && dst_root != &cgrp_dfl_root)
return -EBUSY; return -EBUSY;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment