[LTP] [PATCH] cgroup_fj: don't disable controller that was already enabled
Andrea Cervesato
andrea.cervesato@suse.de
Thu Jun 11 17:03:41 CEST 2026
From: Andrea Cervesato <andrea.cervesato@suse.com>
On immutable distributions (and systemd-managed systems in general)
the cpuset controller is typically already enabled at the root cgroup
level. The cleanup tried to unconditionally disable it via
subtree_control, which failed with EBUSY because other system cgroups
were still using it, producing a spurious TWARN.
Save whether the controller was already enabled at root before
cgroup_require and skip the root-level disable in cleanup when it
was.
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh b/testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh
index 153d351d7936effb15527620f565acaaed7ac747..8b5e73466ba32d2c66a2805a03f4d2136c16509b 100755
--- a/testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh
+++ b/testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh
@@ -57,6 +57,14 @@ create_subgroup()
common_setup()
{
+ # Check if the controller is already enabled at root before
+ # cgroup_require potentially enables it, so that cleanup does
+ # not disable a controller the system was already using.
+ if [ -f /sys/fs/cgroup/cgroup.subtree_control ] && \
+ grep -qw "$subsystem" /sys/fs/cgroup/cgroup.subtree_control; then
+ ctrl_was_enabled=1
+ fi
+
cgroup_require "$subsystem"
mount_point=$(cgroup_get_mountpoint "$subsystem")
start_path=$(cgroup_get_test_path "$subsystem")
@@ -77,7 +85,7 @@ common_cleanup()
cgroup_cleanup
- if [ "$cgroup_version" = "2" ]; then
+ if [ "$cgroup_version" = "2" ] && [ "$ctrl_was_enabled" != "1" ]; then
case "$subsystem" in
cpu|io|memory|pids)
:;;
---
base-commit: a375e8deed471723f5a0114c56eb48fe6f6f45d3
change-id: 20260611-fix_cgroup_immutable-2259f7591f8d
Best regards,
--
Andrea Cervesato <andrea.cervesato@suse.com>
More information about the ltp
mailing list