[CRIU] [PATCH 7/9] mount: restore shared, slave, private properties.
Andrey Vagin
avagin at openvz.org
Wed Jul 24 04:10:21 EDT 2013
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
mount.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/mount.c b/mount.c
index 76b42d6..333b658 100644
--- a/mount.c
+++ b/mount.c
@@ -633,6 +633,27 @@ static char *resolve_source(struct mount_info *mi)
return NULL;
}
+static int restore_shared_options(struct mount_info *mi, bool private, bool shared, bool slave)
+{
+ pr_debug("%d:%s private %d shared %d slave %d\n",
+ mi->mnt_id, mi->mountpoint, private, shared, slave);
+
+ if (private && mount(NULL, mi->mountpoint, NULL, MS_PRIVATE, NULL)) {
+ 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;
+ }
+
+ return 0;
+}
+
/*
* Umount points, which are propagated in slave parents, because
* we can't be sure, that they were inherited in a real life.
@@ -722,6 +743,9 @@ static int do_new_mount(struct mount_info *mi)
return -1;
}
+ if (restore_shared_options(mi, 0, mi->shared_id, 0))
+ return -1;
+
if (tp->restore && tp->restore(mi))
return -1;
--
1.8.3.1
More information about the CRIU
mailing list