[CRIU] [PATCH 1/3] zdtm: mount sysfs if a test is executed in a new set of namespaces

Andrey Vagin avagin at openvz.org
Thu Aug 29 03:31:07 EDT 2013


sysfs contains data which depend on netns. It's similar on relation
between proc and pidns.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 test/zdtm/lib/ns.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/test/zdtm/lib/ns.c b/test/zdtm/lib/ns.c
index cd082d8..fd76c0c 100644
--- a/test/zdtm/lib/ns.c
+++ b/test/zdtm/lib/ns.c
@@ -64,6 +64,14 @@ static int prepare_mntns()
 			fprintf(stderr, "mount(/proc) failed: %m\n");
 			return -1;
 		}
+		if (mkdir("sys", 0777) && errno != EEXIST) {
+			fprintf(stderr, "mkdir(proc) failed: %m\n");
+			return -1;
+		}
+		if (mount("sys", "/sys", "sysfs", MS_MGC_VAL, NULL)) {
+			fprintf(stderr, "mount(/sys) failed: %m\n");
+			return -1;
+		}
 		if (mkdir("/dev", 0755) && errno != EEXIST) {
 			fprintf(stderr, "mkdir(/dev) failed: %m\n");
 			return -1;
-- 
1.8.3.1



More information about the CRIU mailing list