[LTP] [PATCH] cgroup_fj_commmon.sh: Avoid explicitly disabling controllers on cleanup

Cristian Marussi cristian.marussi@arm.com
Thu Feb 27 19:33:59 CET 2025


The cgroup_cleanup helper, called by common_cleanup, takes already care
to remove/disable all the subsystems that were previously enabled using
the complementary cgroup_require helper, for the sake of testing.

Doing it also explicitly after cgroup_cleanup has been called, causes a
WARN that makes all cgroup_fj tests to fail.

  cgroup_fj_function 10 TINFO: Removing all ltp subgroups...
  tst_rod: Failed to open /sys/fs/cgroup/cgroup.subtree_control for writing: Read-only file system
  cgroup_fj_function 10 TWARN: echo -cpuset > /sys/fs/cgroup/cgroup.subtree_control failed

Observed on a Debian Bullseye with systemd using by default cgroup_V1:
in such a case the cgroup_require/cleanup helpers take care to create and
cleanup the cgroup_V2 needed by the testcase, but fail to cleamup for
the above reasons.

Cc: Petr Vorel <pvorel@suse.cz>
Cc: Ma Xinjian <maxj.fnst@fujitsu.com>
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
Tried to add also cpuset to the set of skipped subsystem for cgroup_V2
and it worked but it did feel like the proper solution: digging a bit
into the cgroup helper and debugging the testcase I came to realize that
there was nothinhg to remove/disable left after cgroup_cleanup...

...thoughts ?
---
 .../kernel/controllers/cgroup_fj/cgroup_fj_common.sh      | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh b/testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh
index 153d351d7..6d5586534 100755
--- a/testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh
+++ b/testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh
@@ -76,14 +76,6 @@ common_cleanup()
     [ -d "$start_path" ] && find "$start_path" -depth -type d -exec rmdir '{}' \;
 
     cgroup_cleanup
-
-    if [ "$cgroup_version" = "2" ]; then
-        case "$subsystem" in
-        cpu|io|memory|pids)
-            :;;
-        *) ROD echo "-$subsystem" \> "/sys/fs/cgroup/cgroup.subtree_control";;
-        esac
-    fi
 }
 
 . cgroup_lib.sh
-- 
2.39.5



More information about the ltp mailing list