summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1996-03-17 04:52:10 +0000
committerdyson <dyson@FreeBSD.org>1996-03-17 04:52:10 +0000
commitfb28135c8b0893363bc99979b1db4dc4f0301693 (patch)
tree0a4097e119a743d690584d1a03af8148cf9544e5
parentf5f9b2ee23f286f9f5932ac00601b253ec59836c (diff)
downloadFreeBSD-src-fb28135c8b0893363bc99979b1db4dc4f0301693.zip
FreeBSD-src-fb28135c8b0893363bc99979b1db4dc4f0301693.tar.gz
Yet another fix from BDE for the new pipe code. This fixes a potential
deadlock due to mismanagement of busy counters. Reviewed by: dyson Submitted by: bde
-rw-r--r--sys/kern/sys_pipe.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c
index fb73f19..9bc3bf3 100644
--- a/sys/kern/sys_pipe.c
+++ b/sys/kern/sys_pipe.c
@@ -16,7 +16,7 @@
* 4. Modifications may be freely made to this file if the above conditions
* are met.
*
- * $Id: sys_pipe.c,v 1.12 1996/02/17 14:47:16 peter Exp $
+ * $Id: sys_pipe.c,v 1.13 1996/02/22 03:33:52 dyson Exp $
*/
#ifndef OLD_PIPE
@@ -759,13 +759,12 @@ pipewrite(wpipe, uio, nbio)
}
space = wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt;
+
+ /* Writes of size <= PIPE_BUF must be atomic. */
+ /* XXX perhaps they need to be contiguous to be atomic? */
if ((space < uio->uio_resid) && (orig_resid <= PIPE_BUF))
space = 0;
- /*
- * We must afford contiguous writes on buffers of size
- * PIPE_BUF or less.
- */
if (space > 0) {
int size = wpipe->pipe_buffer.size - wpipe->pipe_buffer.in;
if (size > space)
@@ -831,6 +830,7 @@ pipewrite(wpipe, uio, nbio)
}
}
+ --wpipe->pipe_busy;
if ((wpipe->pipe_busy == 0) &&
(wpipe->pipe_state & PIPE_WANT)) {
wpipe->pipe_state &= ~(PIPE_WANT|PIPE_WANTR);
@@ -866,7 +866,6 @@ pipewrite(wpipe, uio, nbio)
if (wpipe->pipe_buffer.cnt)
pipeselwakeup(wpipe);
- --wpipe->pipe_busy;
return error;
}
OpenPOWER on IntegriCloud