[CRIU] [PATCH] mount: don't overmount a mount if it should be bind-mounted somewhere

Andrey Vagin avagin at openvz.org
Thu Apr 28 13:08:21 PDT 2016


From: Andrew Vagin <avagin at virtuozzo.com>

It's impossiable to make a bind-mount if a source is overmounted.

Reported-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
 criu/mount.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/criu/mount.c b/criu/mount.c
index 0b1c2ba..9dcd7d2 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -2554,6 +2554,14 @@ static bool can_mount_now(struct mount_info *mi)
 	if (!mi->parent)
 		return true;
 
+	if (strcmp(mi->parent->mountpoint, mi->mountpoint) == 0) {
+		struct mount_info *b;
+
+		list_for_each_entry(b, &mi->parent->mnt_bind, mnt_bind)
+			if (!b->mounted)
+				return false;
+	}
+
 	if (mi->external)
 		goto shared;
 
-- 
2.5.5



More information about the CRIU mailing list