Message ID | 20220301122353.16137-1-rpalethorpe@suse.com |
---|---|
State | Accepted |
Headers | show |
Series | API/cgroup: Try to mount V2 with memory_recursiveprot | expand |
On Tue, Mar 1, 2022 at 8:29 PM Richard Palethorpe <rpalethorpe@suse.com> wrote: > 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. > > Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com> > Reviewed-by: Li Wang <liwang@redhat.com>
diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c index dc090b70a..8cca0654d 100644 --- a/lib/tst_cgroup.c +++ b/lib/tst_cgroup.c @@ -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;
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. Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com> --- lib/tst_cgroup.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)