[CRIU] [PATCH] mounts: restero slave, shared mounts correctly

Andrey Vagin avagin at openvz.org
Fri Dec 27 11:59:31 PST 2013


If a mount is slave and it has a shared group. crtools must convert it
in slave and only than crtools can make it shared.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 mount.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/mount.c b/mount.c
index f634737..b7e5b4b 100644
--- a/mount.c
+++ b/mount.c
@@ -921,14 +921,14 @@ static int restore_shared_options(struct mount_info *mi, bool private, bool shar
 		pr_perror("Unable to make %s private", mi->mountpoint);
 		return -1;
 	}
-	if (shared && mount(NULL, mi->mountpoint, NULL, MS_SHARED, NULL)) {
-		pr_perror("Unable to make %s shared", mi->mountpoint);
-		return -1;
-	}
 	if (slave && mount(NULL, mi->mountpoint, NULL, MS_SLAVE, NULL)) {
 		pr_perror("Unable to make %s slave", mi->mountpoint);
 		return -1;
 	}
+	if (shared && mount(NULL, mi->mountpoint, NULL, MS_SHARED, NULL)) {
+		pr_perror("Unable to make %s shared", mi->mountpoint);
+		return -1;
+	}
 
 	return 0;
 }
@@ -1124,7 +1124,7 @@ static int do_bind_mount(struct mount_info *mi)
 	 * shared - the mount is in the same shared group with mi->bind
 	 * mi->shared_id && !shared - create a new shared group
 	 */
-	if (restore_shared_options(mi, !shared,
+	if (restore_shared_options(mi, !shared && !mi->master_id,
 					mi->shared_id && !shared,
 					mi->master_id))
 		return -1;
-- 
1.8.3.1



More information about the CRIU mailing list