summaryrefslogtreecommitdiffstats
path: root/sys/kern/sys_pipe.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2012-03-07 07:31:50 +0000
committerkib <kib@FreeBSD.org>2012-03-07 07:31:50 +0000
commit9d4d411642d8ae4323ed9b0a43cc35dcd602a654 (patch)
tree962288acaad3ba101c032ff509e596c7e1619d71 /sys/kern/sys_pipe.c
parent1ead29e7154b634bb94ffd418424a2000e42c68c (diff)
downloadFreeBSD-src-9d4d411642d8ae4323ed9b0a43cc35dcd602a654.zip
FreeBSD-src-9d4d411642d8ae4323ed9b0a43cc35dcd602a654.tar.gz
The pipe_poll() performs lockless access to the vnode to test
fifo_iseof() condition, allowing the v_fifoinfo to be reset and freed by fifo_cleanup(). Precalculate EOF at the places were fo_wgen is changed, and cache the state in a new pipe state flag PIPE_SAMEWGEN. Reported and tested by: bf Submitted by: gianni MFC after: 1 week (a backport)
Diffstat (limited to 'sys/kern/sys_pipe.c')
-rw-r--r--sys/kern/sys_pipe.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c
index 89b9589..e973c22 100644
--- a/sys/kern/sys_pipe.c
+++ b/sys/kern/sys_pipe.c
@@ -1430,7 +1430,7 @@ pipe_poll(fp, events, active_cred, td)
levents = events &
(POLLIN | POLLINIGNEOF | POLLPRI | POLLRDNORM | POLLRDBAND);
if (rpipe->pipe_state & PIPE_NAMED && fp->f_flag & FREAD && levents &&
- fifo_iseof(fp))
+ rpipe->pipe_state & PIPE_SAMEWGEN)
events |= POLLINIGNEOF;
if ((events & POLLINIGNEOF) == 0) {
OpenPOWER on IntegriCloud