[CRIU] [PATCH 2/2] mnt: remember to restore MS_UNBINDABLE

Tycho Andersen tycho.andersen at canonical.com
Wed Apr 15 12:17:41 PDT 2015


Note that if the root is unbindable then restore will fail because
cr_pivot_root() tries to bind mount the put dir. If this is a case we want to
support, we may want to rearrange how this code is called.

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 mount.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/mount.c b/mount.c
index 17f97a2..0ef6bad 100644
--- a/mount.c
+++ b/mount.c
@@ -1654,6 +1654,13 @@ static int restore_shared_options(struct mount_info *mi, bool private, bool shar
 	pr_debug("%d:%s private %d shared %d slave %d\n",
 			mi->mnt_id, mi->mountpoint, private, shared, slave);
 
+	if (mi->flags & MS_UNBINDABLE) {
+		if (shared || slave)
+			pr_warn("%s has both unbindable and sharing, ignoring unbindable\n", mi->mountpoint);
+		else
+			return mount(NULL, mi->mountpoint, NULL, MS_UNBINDABLE, NULL);
+	}
+
 	if (private && mount(NULL, mi->mountpoint, NULL, MS_PRIVATE, NULL)) {
 		pr_perror("Unable to make %s private", mi->mountpoint);
 		return -1;
-- 
2.1.4



More information about the CRIU mailing list