[CRIU] [PATCH 11/16] zdtm: mark all mounts as private for one call

Andrey Vagin avagin at openvz.org
Tue Apr 8 16:35:03 PDT 2014


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

diff --git a/test/zdtm/live/static/mountpoints.c b/test/zdtm/live/static/mountpoints.c
index ff2afc6..7200544 100644
--- a/test/zdtm/live/static/mountpoints.c
+++ b/test/zdtm/live/static/mountpoints.c
@@ -77,6 +77,11 @@ again:
 		return -1;
 	}
 
+	if (mount(NULL, "/", NULL, MS_REC|MS_PRIVATE, NULL)) {
+		err("Can't remount / with MS_PRIVATE");
+		return -1;
+	}
+
 	while (fgets(buf, sizeof(buf), f) != NULL) {
 		char *mp = buf, *end;
 
@@ -87,21 +92,14 @@ again:
 		end = strchr(mp, ' ');
 		*end = '\0';
 
-		if (private) {
-			if (!strcmp(mp, "/"))
-				continue;
-			if (!strcmp(mp, "/proc"))
-				continue;
-
-			if (umount(mp))
-				test_msg("umount(`%s') failed: %m\n", mp);
-		} else {
-			/* mount --make-rprivate / */
-			if (mount("none", mp, "none", MS_REC|MS_PRIVATE, NULL)) {
-				err("Can't remount %s with MS_PRIVATE", mp);
-				return -1;
-			}
-		}
+		if (!strcmp(mp, "/"))
+			continue;
+		if (!strcmp(mp, "/proc"))
+			continue;
+
+		if (umount(mp))
+			test_msg("umount(`%s') failed: %m\n", mp);
+
 		fs_cnt++;
 	}
 
-- 
1.8.5.3



More information about the CRIU mailing list