[CRIU] Re: [PATCH 2/3] files-reg: Create fifo ghost node if needed

Cyrill Gorcunov gorcunov at openvz.org
Wed Jun 27 13:29:53 EDT 2012


On Wed, Jun 27, 2012 at 09:18:07PM +0400, Pavel Emelyanov wrote:
 
> > @@ -184,12 +196,13 @@ static int dump_ghost_file(int _fd, u32 id, const struct stat *st)
> >  	 * permissions when drained
> >  	 */
> >  	snprintf(lpath, sizeof(lpath), "/proc/self/fd/%d", _fd);
> > -	fd = open(lpath, O_RDONLY);
> > +	fd = open(lpath, O_RDWR); /* To not block if fifo */
> 
> You don't have to open fifo here at all.
> 

True, thanks.

> >  	snprintf(gf->path, PATH_MAX, "%s.cr.%x.ghost", rfi->path, rfe->remap_id);
> > -	gfd = open(gf->path, O_WRONLY | O_CREAT | O_EXCL, gfe.mode);
> > +
> > +	if (S_ISFIFO(gfe.mode)) {
> > +		if (mknod(gf->path, gfe.mode, gfe.dev)) {
> 
> dev is ignored for fifos by mknod.

True again, will update. Pavel are you fine with using S_ISFIFO approach
instead of virtual ops for a while?

	Cyrill


More information about the CRIU mailing list