[CRIU] [PATCH 2/2] mnt: add support for external shared mounts

Tycho Andersen tycho.andersen at canonical.com
Mon Apr 6 12:52:19 PDT 2015


On Mon, Apr 06, 2015 at 10:39:08PM +0300, Pavel Emelyanov wrote:
> 
> >  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.

Oh, whoops. Looks like I misread the flow, thanks.

Tycho

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