[CRIU] [PATCH 2/2] mnt: add support for external shared mounts
Pavel Emelyanov
xemul at parallels.com
Mon Apr 6 12:39:08 PDT 2015
> int collect_mnt_namespaces(bool for_dump)
> {
> - int need_to_validate = 0, ret;
> + int need_to_validate = 0, ret, orig_root_ns_mask = root_ns_mask;
> +
> + /*
> + * XXX: this is a little bit of spaghetti. If we are allowing external
> + * masters, we want to collect the criu pid's mountinfo (and thus the
> + * whole mountns) so we can corrolate the external masters. So we clear
> + * the mountns bit for this call to walk_namespaces.
> + *
> + * However, we don't want to add criu's mountns to the dump target list
> + * if it isn't really going to be dumped, so we set the
> + * really_collect_self_mounts flag if we really do want to collect them
> + * above.
> + */
> + if (opts.enable_external_masters) {
> + if (!(root_ns_mask & CLONE_NEWNS))
> + really_collect_self_mounts = true;
> + else
> + root_ns_mask &= ~CLONE_NEWNS;
This can make walk_namespaces() skip all the namespaces but CRIU's one. The function
in question can work in two modes only -- either it scans all namespaces but CIRU's,
or only the CRIU's. _It_ should be patched to force it walk _all_ the namespaces in
some situations.
> + }
>
> ret = walk_namespaces(&mnt_ns_desc, collect_mntns, &need_to_validate);
> + if (opts.enable_external_masters) {
> + root_ns_mask = orig_root_ns_mask;
> + }
> +
> if (ret)
> goto err;
>
> if (for_dump && need_to_validate) {
> ret = -1;
>
> - if (collect_shared(mntinfo))
> + if (collect_shared(mntinfo, true))
> goto err;
> if (validate_mounts(mntinfo, true))
> goto err;
More information about the CRIU
mailing list