[CRIU] [PATCH 2/2] fsnotify: Always provide the path for inotify watchees

Cyrill Gorcunov gorcunov at gmail.com
Tue Oct 13 12:22:34 PDT 2015


On Tue, Oct 13, 2015 at 10:17:45PM +0300, Andrew Vagin wrote:
> >  
> >  		/*
> > -		 * Inode numbers are not restored for tmpfs content, but we can
> > -		 * get file names, becasue tmpfs cache is not pruned.
> > +		 * Convert to relative path.
> >  		 */
> > -		if ((mi->fstype->code == FSTYPE__TMPFS) ||
> > -				(mi->fstype->code == FSTYPE__DEVTMPFS)) {
> 
> Why do we remove this check?

Ah. I think for this case we need some test somewhere below, which would
exit with error if no suitable link found. Thanks. Will update.

> 
> > -			char p[PATH_MAX];
> > +		__path = (buf[1] != '\0') ? buf + 1 : buf;
> > +		pr_debug("\t\t\tlink as %s\n", __path);
> >  
> > -			if (read_fd_link(fd, p, sizeof(p)) < 0)
> > -				goto err;
> > +		mntfd = mntns_get_root_by_mnt_id(m->mnt_id);
> > +		if (mntfd < 0)
> > +			continue;
> >  
> > -			path = xstrdup(p);
> > +		new = openat(mntfd, __path, O_PATH);
> > +		close(new);
> > +
> > +		if (new >= 0) {
> > +			pr_debug("\t\t\topenable as %s\n", __path);
> 
> 	close(new) should be here

Why? We don't use new after the openat call, we simply need
to know if it failed or no. Or you prefer this way simply for
taste?


More information about the CRIU mailing list