[CRIU] [PATCH CRIU 1/4] mount: get over autodetected mounts in search for widest shared peer

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Wed Jan 20 07:42:55 PST 2016


now all autodetected mounts are considered to be shared - fix it

In VZ7:
vzctl exec 101 mkdir /testmounts /testmounts/dir /testmounts/bind
	/testmounts/tmp /testmounts/dir/b
vzctl exec 101 mount --bind /testmounts/dir /testmounts/bind
vzctl exec 101 mount --bind /testmounts/tmp /testmounts/bind/b
vzctl suspend 101; vzctl resume 101

In criu logs:
The restore log was saved in /vz/private/101/dump/Dump/restore.log
Failed to restore the Container

(00.213750)      1: Error (mount.c:631): mnt: 134:./testmounts/bind and
137:./testmounts/dir/b have different set of mounts

but those two are really different

https://jira.sw.ru/browse/PSBM-42829
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 mount.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/mount.c b/mount.c
index 9d5667a..e267e10 100644
--- a/mount.c
+++ b/mount.c
@@ -472,14 +472,27 @@ static int try_resolve_ext_mount(struct mount_info *info)
 static struct mount_info *find_widest_shared(struct mount_info *m)
 {
 	struct mount_info *p;
+	bool madm = !strcmp(m->root, AUTODETECTED_MOUNT);
 
 	/*
 	 * Try to find a mount, which is wider or equal.
 	 * A is wider than B, if A->root is a subpath of B->root.
 	 */
-	list_for_each_entry(p, &m->mnt_share, mnt_share)
-		if (issubpath(m->root, p->root))
+	list_for_each_entry(p, &m->mnt_share, mnt_share) {
+		bool padm = !strcmp(p->root, AUTODETECTED_MOUNT);
+
+		/* Skip check between different kinds of mounts */
+		if (madm != padm)
+			continue;
+
+		/*
+		 * Compare source for autodetected mounts as
+		 * root is always "CRIU:AUTOGENERATED" for them
+		 */
+		if ((madm && issubpath(m->source, p->source))
+		    || (!madm && issubpath(m->root, p->root)))
 			return p;
+	}
 
 	return NULL;
 }
-- 
1.9.3



More information about the CRIU mailing list