svn commit: r367835 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Thu Nov 19 08:16:46 UTC 2020


Author: mjg
Date: Thu Nov 19 08:16:45 2020
New Revision: 367835
URL: https://svnweb.freebsd.org/changeset/base/367835

Log:
  pipe: tidy up pipelock

Modified:
  head/sys/kern/sys_pipe.c

Modified: head/sys/kern/sys_pipe.c
==============================================================================
--- head/sys/kern/sys_pipe.c	Thu Nov 19 07:23:39 2020	(r367834)
+++ head/sys/kern/sys_pipe.c	Thu Nov 19 08:16:45 2020	(r367835)
@@ -614,14 +614,17 @@ pipespace(struct pipe *cpipe, int size)
 static __inline int
 pipelock(struct pipe *cpipe, int catch)
 {
-	int error;
+	int error, prio;
 
 	PIPE_LOCK_ASSERT(cpipe, MA_OWNED);
+
+	prio = PRIBIO;
+	if (catch)
+		prio |= PCATCH;
 	while (cpipe->pipe_state & PIPE_LOCKFL) {
 		cpipe->pipe_state |= PIPE_LWANT;
 		error = msleep(cpipe, PIPE_MTX(cpipe),
-		    catch ? (PRIBIO | PCATCH) : PRIBIO,
-		    "pipelk", 0);
+		    prio, "pipelk", 0);
 		if (error != 0)
 			return (error);
 	}


More information about the svn-src-head mailing list