View | Details | Raw Unified | Return to bug 203366 | Differences between
and this patch

Collapse All | Expand All

(-)b/sys/kern/sys_pipe.c (-1 / +14 lines)
Lines 821-827 unlocked_error: Link Here
821
		}
821
		}
822
	}
822
	}
823
823
824
	if ((rpipe->pipe_buffer.size - rpipe->pipe_buffer.cnt) >= PIPE_BUF)
824
	/*
825
	 * Only wake up writers if there was actually something read.
826
	 * Otherwise, when calling read(2) at EOF, pipeselwakeup would
827
	 * re-trigger EVFILT_READ/EV_EOF notifications that might have just
828
	 * been cleared with EV_CLEAR, resulting in an infinite loop (see PR
829
	 * 203366):
830
	 *
831
	 * kevent(4,...,{ 3,EVFILT_READ,EV_CLEAR|EV_EOF,...},1,0x0) = 1 (0x1)
832
	 * read(3,...,4096)                         = 0 (0x0)
833
	 * kevent(4,...,{ 3,EVFILT_READ,EV_CLEAR|EV_EOF,...},1,0x0) = 1 (0x1)
834
	 * ...
835
	 */
836
	if (nread > 0 &&
837
	    (rpipe->pipe_buffer.size - rpipe->pipe_buffer.cnt) >= PIPE_BUF)
825
		pipeselwakeup(rpipe);
838
		pipeselwakeup(rpipe);
826
839
827
	PIPE_UNLOCK(rpipe);
840
	PIPE_UNLOCK(rpipe);

Return to bug 203366