[CRIU] [PATCH] pipe: don't reopen pipes via /proc, if it's not required

Pavel Emelyanov xemul at parallels.com
Mon Mar 18 14:37:06 EDT 2013


> @@ -129,6 +131,15 @@ void mark_pipe_master(void)
>  
>  		fle = file_master(&pi->d);
>  		p = pi;
> +		if (!(pi->pe->flags & O_LARGEFILE)) {

You rely on O_LARGEFILE presence to determine whether or not to reopen a pipe?

> +			if (pi->pe->flags & O_WRONLY) {
> +				if (pw == NULL)
> +					pw = pi;
> +			} else {
> +				if (pr == NULL)
> +					pr = pi;
> +			}
> +		}
>  
>  		list_for_each_entry(pic, &pi->pipe_list, pipe_list) {
>  			struct fdinfo_list_entry *f;

> @@ -302,6 +339,9 @@ static int open_pipe(struct file_desc *d)
>  	close(pfd[!(pi->pe->flags & O_WRONLY)]);
>  	tmp = pfd[pi->pe->flags & O_WRONLY];
>  
> +	if (pi->reopen)
> +		tmp = reopen_pipe(tmp, pi->pe->flags, pi);

tmp can be -1 and it's not checked.

> +
>  	if (rst_file_params(tmp, pi->pe->fown, pi->pe->flags))
>  		return -1;
>  


More information about the CRIU mailing list