[CRIU] Sync TODO-s for mount.c work

Oleg Nesterov oleg at redhat.com
Thu Apr 23 08:03:52 PDT 2015


On 04/23, Oleg Nesterov wrote:
>
> On 04/23, Pavel Emelyanov wrote:
> >
> > On 04/23/2015 02:17 PM, Oleg Nesterov wrote:
> >
> > > Now what? Obviously we can't just add
> > >
> > > 	if (is_not_external_mount(m))
> > > 		continue;
> >
> > Why not? The is_not_external_mount() is
> >
> > fsroot_mounted(m) || /* mount's root is visible from chroot */
>
> Yes, perhaps this can work as a first approximation, but afaics this
> is not enough with MS_SLAVE...

Lets "enumerate" the problems step by step. And lets ignore the
"|| /* mount's root is visible from chroot */" above. Once again,
this is not needed in _this particular case_.

Lets start with the patch at the end.

With this patch

	# unshare -m
	# perl -e 'close STDIN; close STDOUT; close STDERR; sleep'

can be dumped/restored with
"--ext-mount-map auto --enable-external-masters --enable-external-sharing",

	# unshare -m
	# mkdir /tmp/A /tmp/B
	# mount --bind /tmp/A /tmp/B
	# perl -e 'close STDIN; close STDOUT; close STDERR; sleep'

works too. Good! "--ext-mount-map auto" does its work correctly.

Just in case,

	# unshare -m
	# mount --make-slave /
	# mount --make-shared /
	# mount --bind /tmp/A /tmp/B
	# perl -e 'close STDIN; close STDOUT; close STDERR; sleep'

is also fine.

However,

	# unshare -m
	# mount --make-rslave /
	# perl -e 'close STDIN; close STDOUT; close STDERR; sleep'
	
doesn't work. dump fails with

	Error (mount.c:883): Mount 34 ./run (master_id: 22 shared_id: 0) has unreachable sharing. Try --enable-external-masters.

(note that "Try --enable-external-masters" is wrong, this option was
 specified, but this is minor).

What should/can we do?

Tycho, Pavel. Sorry, I need to run away right now. I see the new
emails from Tycho but I didn't read them yet. See you tomorrow.


Oleg.

--- a/mount.c
+++ b/mount.c
@@ -742,6 +742,12 @@ static struct ns_id *find_ext_ns_id(void)
 	return NULL;
 }
 
+static bool is_not_external_mount(struct mount_info *m)
+{
+	/* FIXME: this is wrong/incomplete */
+	return fsroot_mounted(m);
+}
+
 static int resolve_external_mounts(struct mount_info *info)
 {
 	struct ns_id *ext_ns = NULL;
@@ -762,6 +768,9 @@ static int resolve_external_mounts(struct mount_info *info)
 		if (m->parent == NULL || m->is_ns_root)
 			continue;
 
+		if (is_not_external_mount(m))
+			continue;
+
 		ret = try_resolve_ext_mount(m);
 		if (ret < 0 && ret != -ENOTSUP) {
 			return -1;



More information about the CRIU mailing list