summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2014-12-29 00:30:38 +0000
committerkib <kib@FreeBSD.org>2014-12-29 00:30:38 +0000
commit517ef2d35127d2138a5e90592861babfc9888aa5 (patch)
tree643f44f61d81ff234d69505e4e2bd56404c94051
parent88c1adb41738babfd568dce3befb4b0b1b9fd799 (diff)
downloadFreeBSD-src-517ef2d35127d2138a5e90592861babfc9888aa5.zip
FreeBSD-src-517ef2d35127d2138a5e90592861babfc9888aa5.tar.gz
MFC r275260:
Remove lock recursion for the pipe pair mutex, and disable the recursion on mutex initialization.
-rw-r--r--sys/kern/sys_pipe.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c
index 9ee4fde..1e63dba 100644
--- a/sys/kern/sys_pipe.c
+++ b/sys/kern/sys_pipe.c
@@ -315,7 +315,7 @@ pipe_zone_init(void *mem, int size, int flags)
pp = (struct pipepair *)mem;
- mtx_init(&pp->pp_mtx, "pipe mutex", NULL, MTX_DEF | MTX_RECURSE);
+ mtx_init(&pp->pp_mtx, "pipe mutex", NULL, MTX_DEF);
return (0);
}
@@ -1770,7 +1770,7 @@ filt_piperead(struct knote *kn, long hint)
struct pipe *wpipe = rpipe->pipe_peer;
int ret;
- PIPE_LOCK(rpipe);
+ PIPE_LOCK_ASSERT(rpipe, MA_OWNED);
kn->kn_data = rpipe->pipe_buffer.cnt;
if ((kn->kn_data == 0) && (rpipe->pipe_state & PIPE_DIRECTW))
kn->kn_data = rpipe->pipe_map.cnt;
@@ -1779,11 +1779,9 @@ filt_piperead(struct knote *kn, long hint)
wpipe->pipe_present != PIPE_ACTIVE ||
(wpipe->pipe_state & PIPE_EOF)) {
kn->kn_flags |= EV_EOF;
- PIPE_UNLOCK(rpipe);
return (1);
}
ret = kn->kn_data > 0;
- PIPE_UNLOCK(rpipe);
return ret;
}
@@ -1794,12 +1792,11 @@ filt_pipewrite(struct knote *kn, long hint)
struct pipe *wpipe;
wpipe = kn->kn_hook;
- PIPE_LOCK(wpipe);
+ PIPE_LOCK_ASSERT(wpipe, MA_OWNED);
if (wpipe->pipe_present != PIPE_ACTIVE ||
(wpipe->pipe_state & PIPE_EOF)) {
kn->kn_data = 0;
kn->kn_flags |= EV_EOF;
- PIPE_UNLOCK(wpipe);
return (1);
}
kn->kn_data = (wpipe->pipe_buffer.size > 0) ?
@@ -1807,7 +1804,6 @@ filt_pipewrite(struct knote *kn, long hint)
if (wpipe->pipe_state & PIPE_DIRECTW)
kn->kn_data = 0;
- PIPE_UNLOCK(wpipe);
return (kn->kn_data >= PIPE_BUF);
}
OpenPOWER on IntegriCloud