svn commit: r368038 - head/sys/kern

John Baldwin jhb at FreeBSD.org
Wed Nov 25 21:54:11 UTC 2020


On 11/25/20 1:41 PM, Mateusz Guzik wrote:
> Author: mjg
> Date: Wed Nov 25 21:41:23 2020
> New Revision: 368038
> URL: https://svnweb.freebsd.org/changeset/base/368038
> 
> Log:
>   pipe: drop spurious pipeunlock/pipelock cycle on write
> 
> Modified:
>   head/sys/kern/sys_pipe.c
> 
> Modified: head/sys/kern/sys_pipe.c
> ==============================================================================
> --- head/sys/kern/sys_pipe.c	Wed Nov 25 21:25:17 2020	(r368037)
> +++ head/sys/kern/sys_pipe.c	Wed Nov 25 21:41:23 2020	(r368038)
> @@ -997,10 +993,9 @@ retry:
>  		pipeunlock(wpipe);
>  		error = msleep(wpipe, PIPE_MTX(wpipe),
>  		    PRIBIO | PCATCH, "pipdww", 0);
> +		pipelock(wpipe, 0);
>  		if (error)
>  			goto error1;
> -		else
> -			goto retry;
>  	}

Hmm, what ensures that PIPE_EOF and PIPE_DIRECTW aren't still
set once awakened that would permit removing the 'goto retry'?
The goto is still present in the other case in this function, it
was only removed from this one?

> @@ -1282,12 +1270,13 @@ pipe_write(struct file *fp, struct uio *uio, struct uc
>  			pipeunlock(wpipe);
>  			error = msleep(wpipe, PIPE_MTX(rpipe),
>  			    PRIBIO | PCATCH, "pipewr", 0);
> +			pipelock(wpipe, 0);
>  			if (error != 0)
>  				break;
> +			continue;

A continue as the last line of a while() loop seems spurious?

-- 
John Baldwin


More information about the svn-src-head mailing list