[CRIU] [PATCH] mount: don't do MS_REC|MS_PRIVATE for host mounts

Andrey Vagin avagin at openvz.org
Tue Jun 21 23:59:16 PDT 2016


From: Andrew Vagin <avagin at virtuozzo.com>

Here is a race when someone umounted something and this operation
isn't propagated into our namespace.

CRIU					| Another process
-----------------------------------------------------------------
pivot_root(".", put_root)		|
mount(put_root, MS_REC|MS_PRIVATE)	|
					| umount /xxx/yyy
					| umount /xxx -> EBUSY
umount(put_root)

We do this to not affect mounts in put_root, but we can mask
these mounts as slave and this will work for us and for external
users.

Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
 criu/mount.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/criu/mount.c b/criu/mount.c
index e891c92..e3b837f 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -2733,7 +2733,7 @@ static int cr_pivot_root(char *root)
 		goto err_tmpfs;
 	}
 
-	if (mount("none", put_root, "none", MS_REC|MS_PRIVATE, NULL)) {
+	if (mount("none", put_root, "none", MS_REC|MS_SLAVE, NULL)) {
 		pr_perror("Can't remount root with MS_PRIVATE");
 		return -1;
 	}
-- 
2.7.4



More information about the CRIU mailing list