From 90e79b741cdf96badf69b628b9f5036ff0af6ae7 Mon Sep 17 00:00:00 2001 From: Tycho Andersen Date: Wed, 15 Apr 2015 22:17:00 +0300 Subject: [PATCH] mnt: remember to restore MS_UNBINDABLE 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 Signed-off-by: Pavel Emelyanov --- mount.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mount.c b/mount.c index 1f67aa04a..65f897ba8 100644 --- a/mount.c +++ b/mount.c @@ -1717,6 +1717,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;