<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Aug 7, 2020 at 5:42 PM Yang Xu <<a href="mailto:xuyang2018.jy@cn.fujitsu.com">xuyang2018.jy@cn.fujitsu.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">When running cgroup test cases(like cpuset01 or oom05) about cpuset subsystem<br>
firstly, then cpuset_inherit case will fail because the value of<br>
cgroup.clone_children has been changed into 1 on cgroup-v1. Reset this value<br>
when calling tst_cgroupN_umount.<br>
<br>
Signed-off-by: Yang Xu <<a href="mailto:xuyang2018.jy@cn.fujitsu.com" target="_blank">xuyang2018.jy@cn.fujitsu.com</a>><br>
---<br>
 lib/tst_cgroup.c | 8 ++++++++<br>
 1 file changed, 8 insertions(+)<br>
<br>
diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c<br>
index 9459f7ea0..764951afa 100644<br>
--- a/lib/tst_cgroup.c<br>
+++ b/lib/tst_cgroup.c<br>
@@ -9,6 +9,8 @@<br>
 #include <stdio.h><br>
 #include <stdlib.h><br>
 #include <sys/mount.h><br>
+#include <fcntl.h><br>
+#include <unistd.h><br>
<br>
 #include "tst_test.h"<br>
 #include "tst_safe_macros.h"<br>
@@ -123,6 +125,7 @@ static void tst_cgroupN_umount(const char *mnt_path, const char *new_path)<br>
        FILE *fp;<br>
        int fd;<br>
        char s_new[BUFSIZ], s[BUFSIZ], value[BUFSIZ];<br>
+       char knob_path[PATH_MAX];<br>
<br>
        if (!tst_is_mounted(mnt_path))<br>
                return;<br>
@@ -151,6 +154,11 @@ static void tst_cgroupN_umount(const char *mnt_path, const char *new_path)<br>
                            != (ssize_t)strlen(value) - 1)<br>
                                tst_res(TWARN | TERRNO, "write %s", s);<br>
        }<br>
+       if (tst_cg_ver & TST_CGROUP_V1) {<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">To recognize cgroup_v1 is not enough here, because it will be failed "with no such <span class="gmail_default"></span>cgroup.clone_children file" on MEMCG umount if the system no CPUSET mounting.</div><br></div><div><div class="gmail_default" style="font-size:small">Maybe a smart way is to save the <span class="gmail_default"></span>cgroup.clone_children value, restore it if it has been changed in the setup phase. What do u think?</div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+               sprintf(knob_path, "%s/<span class="gmail_default" style="font-size:small"></span><span class="gmail_default" style="font-size:small"></span>cgroup.clone_children", mnt_path);<br>
+               if (!access(knob_path, F_OK))<br>
+                       SAFE_FILE_PRINTF(knob_path, "%d", 0);<br>
+       }<br>
        if (fd != -1)<br>
                close(fd);<br>
        if (fp != NULL)<br>
-- <br>
2.23.0<br>
<br>
<br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>