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

Andrew Vagin avagin at virtuozzo.com
Thu Jan 21 15:52:10 PST 2016


On Thu, Jan 21, 2016 at 01:08:41AM +0300, Pavel Tikhomirov wrote:
> 
> 
> On 01/20/2016 09:23 PM, Andrew Vagin wrote:
> >On Wed, Jan 20, 2016 at 06:42:55PM +0300, Pavel Tikhomirov wrote:
> >>now all autodetected mounts are considered to be shared - fix it
> >
> >I don't understand what and how you fix.
> 
> In collect_mnt_namespaces->resolve_external_mounts if "--ext-mount-map auto"
> is set all mounts which are resolved external have set m->external->val =
> "CRIU:AUTOGENERATED". Thus in dump_one_mountpoint, m->root is set to it. So
> on restore in prepare_namespace->prepare_mnt_ns
> ->populate_mnt_ns->validate_mounts->find_widest_shared->issubpath
> for all external mounts we check issubpath("CRIU:AUTOGENERATED",
> "CRIU:AUTOGENERATED") and for matched mounts check that they are equal. So
> next in validate_shared validation fails for really different external
> mounts. I propose to check sources for such mounts instead of roots.

It's a bad idea to rewrite m->root by CRIU:AUTOGENERATED. In this case
we can't restore shared mounts properly.

> 
> >
> >>
> >>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