[CRIU] [PATCH 3/5] files: Rework clean_one_remap to order ghost dirs removal

Cyrill Gorcunov gorcunov at gmail.com
Mon Feb 25 17:31:05 MSK 2019


On Mon, Feb 25, 2019 at 02:20:11PM +0000, Pavel Tikhomirov wrote:
...
> > +
> > +	/*
> > +	 * Otherwise simply order by mnt_id order, we just
> > +	 * can't do anything beter (it is early stage where
> > +	 * mounts are not yet processed).
> 
> What exact problem is with different mounts, can you show an example 
> paths? (AFAICS Mount trees are already built at these point)

Can we have same "paths" under different mounts? I think we can.
Thus we can order only paths which are under same mount.
And no, at this moment they are not yet constructed.

> >   
> > -	ret = unlinkat(rmntns_root, remap->rpath, remap->is_dir ? AT_REMOVEDIR : 0);
> > -	if (ret < 0) {
> > -		close(rmntns_root);
> > -		pr_perror("Couldn't unlink remap %s %s", path, remap->rpath);
> > +	if (remap->is_dir)
> > +		ret = clean_ghost_dir(rmntns_root, ri);
> > +	else
> > +		ret = unlinkat(rmntns_root, remap->rpath, 0);
> > +
> > +	if (ret) {
> > +		pr_perror("Couldn't unlink remap %d %s", rmntns_root, remap->rpath);
> >   		return -1;
> >   	}
> > -	close(rmntns_root);
> 
> Don't you leak rmntns_root fd here?

Sharp eyes! Thanks, indeed! Will update.

	Cyrill


More information about the CRIU mailing list