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

Pavel Emelyanov xemul at parallels.com
Mon Mar 18 15:56:43 EDT 2013


On 03/18/2013 11:49 PM, Andrew Vagin wrote:
> On Mon, Mar 18, 2013 at 10:37:06PM +0400, Pavel Emelyanov wrote:
>>> @@ -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?
> 
> A point is reopend for unsharing a file descriptor. So here are two
> types of points. One is returned by pipe() and all other ones are
> got via opening /proc/PID/fd.
> 
> Currently I know only one difference between these types, it's
> O_LARGEFILE.

kcmp-generated IDs are such as well

>>
>>> +			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.
> 
> Thanks, I will fix.
> 
>>
>>> +
>>>  	if (rst_file_params(tmp, pi->pe->fown, pi->pe->flags))
>>>  		return -1;
>>>  
> .
> 




More information about the CRIU mailing list