[CRIU] [PATCH 3/3] zdtm: check that overmounted parts of tmpfs are restored

Andrey Vagin avagin at openvz.org
Mon Jul 29 10:34:17 EDT 2013


Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 test/zdtm/live/static/mountpoints.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/test/zdtm/live/static/mountpoints.c b/test/zdtm/live/static/mountpoints.c
index dde9de8..1109711 100644
--- a/test/zdtm/live/static/mountpoints.c
+++ b/test/zdtm/live/static/mountpoints.c
@@ -97,6 +97,19 @@ done:
 		return 1;
 	}
 
+	/* Check that over-mounted files are restored on tmpfs */
+	mkdir(MPTS_ROOT"/dev/overmount", 0600);
+	fd = open(MPTS_ROOT"/dev/overmount/test.over", O_WRONLY | O_CREAT);
+	if (fd == -1) {
+		err("Unable to open "MPTS_ROOT"/dev/overmount\n");
+		return -1;
+	}
+	close(fd);
+	if (mount("none", MPTS_ROOT"/dev/overmount", "tmpfs", 0, "") < 0) {
+		err("Can't mount "MPTS_ROOT"/dev/overmount\n");
+		return 1;
+	}
+
 	if (mount("none", MPTS_ROOT"/kernel", "proc", 0, "") < 0) {
 		fail("Can't mount proc");
 		return 1;
@@ -125,6 +138,15 @@ done:
 		return 1;
 	}
 
+	if (umount(MPTS_ROOT"/dev/overmount") == -1) {
+		err("Can't umount "MPTS_ROOT"/dev/overmount\n");
+		return -1;
+	}
+	if (access(MPTS_ROOT"/dev/overmount/test.over", F_OK)) {
+		fail(MPTS_ROOT"/dev/overmount/test.over");
+		return -1;
+	}
+
 	pass();
 	return 0;
 }
-- 
1.8.3.1



More information about the CRIU mailing list