Skip to content

Commit 7fd8c56

Browse files
committed
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: Tejun Heo <[email protected]> Acked-by: Li Zefan <[email protected]>
1 parent 6803c00 commit 7fd8c56

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

kernel/cgroup.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,16 +1051,12 @@ static int rebind_subsystems(struct cgroup_root *dst_root,
10511051
if (!(ss_mask & (1 << ssid)))
10521052
continue;
10531053

1054-
/* if @ss is on the dummy_root, we can always move it */
1055-
if (ss->root == &cgrp_dfl_root)
1056-
continue;
1057-
1058-
/* if @ss has non-root cgroups attached to it, can't move */
1059-
if (!list_empty(&ss->root->cgrp.children))
1054+
/* if @ss has non-root csses attached to it, can't move */
1055+
if (css_next_child(NULL, cgroup_css(&ss->root->cgrp, ss)))
10601056
return -EBUSY;
10611057

10621058
/* can't move between two non-dummy roots either */
1063-
if (dst_root != &cgrp_dfl_root)
1059+
if (ss->root != &cgrp_dfl_root && dst_root != &cgrp_dfl_root)
10641060
return -EBUSY;
10651061
}
10661062

0 commit comments

Comments
 (0)