Skip to contentSkip to conversation

API/cgroup: Try to mount V2 with memory_recursiveprot

PATCH In review Richard Palethorpe via ltp 2 participants 2 messages Mar 1, 2022 – Mar 2, 2022 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 API/cgroup: Try to mount V2 with memory_recursiveprot

Moving forwards system managers should always mount with memory_recursiveprot. So we should test with this by default when it is available.

This change will only effect SUTs which do not already have CGroups mounted.

---
 lib/tst_cgroup.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
lib/tst_cgroup.c +8 -1
index dc090b70a..8cca0654d 100644
@@ -471,6 +471,7 @@ void tst_cg_scan(void)
 
 static void cgroup_mount_v2(void)
 {
+	int ret;
 	char mnt_path[PATH_MAX];
 
 	sprintf(mnt_path, "%s%s", cgroup_mount_ltp_prefix, cgroup_v2_ltp_mount);
@@ -494,7 +495,13 @@ static void cgroup_mount_v2(void)
 	return;
 
 mount:
-	if (!mount("cgroup2", mnt_path, "cgroup2", 0, NULL)) {
+	ret = mount("cgroup2", mnt_path, "cgroup2",
+		    0, "memory_recursiveprot");
+
+	if (ret && errno == EINVAL)
+		ret = mount("cgroup2", mnt_path, "cgroup2", 0, NULL);
+
+	if (!ret) {
 		tst_res(TINFO, "Mounted V2 CGroups on %s", mnt_path);
 		tst_cg_scan();
 		roots[0].we_mounted_it = 1;
Signature · 5 lines
2.34.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Richard Palethorpe

Moving forwards system managers should always mount with memory_recursiveprot. So we should test with this by default when it is available.

This change will only effect SUTs which do not already have CGroups mounted.

Signature · 2 lines
Regards,
Li Wang
Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp