[CRIU] Re: [PATCH 0/7] fifo c/r updated

Pavel Emelyanov xemul at parallels.com
Sun Jul 1 08:38:42 EDT 2012


On 06/28/2012 07:59 PM, Cyrill Gorcunov wrote:
> Guys, take a look please, thanks!
> 
> 

OK, this look very close to get merged (modulo ghost files beautification).
Some comments to fix and I take it:

> @@ -105,8 +115,10 @@ static int open_remap_ghost(struct reg_file_info *rfi,
>  		goto err;
>  	}
>  
> -	if (copy_file(ifd, gfd, 0) < 0)
> -		goto err;
> +	if (!S_ISFIFO(gfe.mode)) {

This should be S_ISREG

> +		if (copy_file(ifd, gfd, 0) < 0)
> +			goto err;
> +	}
>  
>  	close(ifd);
>  	close(gfd);

> +static int __open_fifo_fd(struct reg_file_info *rfi)
> +{
> +	struct fifo_info *info = rfi->priv;
> +	int new_fifo, fake_fifo = -1;
> +
> +	/*
> +	 * The fifos (except read-write fifos) do wait until
> +	 * another pipe-end get connected, so to be able to
> +	 * proceed the restoration procedure we open a fake
> +	 * fifo here.
> +	 */
> +	fake_fifo = open(rfi->path, O_RDWR);
> +	if (fake_fifo < 0) {
> +		pr_perror("Can't open fake fifo %#x [%s]", info->fe.id, rfi->path);
> +		return -1;
> +	}
> +
> +	new_fifo = open(rfi->path, rfi->rfe.flags);
> +	if (new_fifo < 0) {
> +		pr_perror("Can't open fifo %#x [%s]", info->fe.id, rfi->path);
> +		goto out;
> +	}
> +
> +	if (info->restore_data) {
> +		if (restore_pipe_data(CR_FD_FIFO_DATA, fake_fifo, info->fe.id,
> +				      info->bytes, info->off)) {
> +			close(new_fifo);
> +			new_fifo = -1;
> +		}
> +	}

Fifo data restore is not a part of fifo virtual opening by open_fe_fd.
This part should be in static int open_fifo_fd(struct file_desc *d).

> +out:
> +	close(fake_fifo);
> +	return new_fifo;
> +}



More information about the CRIU mailing list