]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r351348 (by markj):
authorAlexander Motin <mav@FreeBSD.org>
Tue, 27 Aug 2019 03:05:57 +0000 (03:05 +0000)
committerAlexander Motin <mav@FreeBSD.org>
Tue, 27 Aug 2019 03:05:57 +0000 (03:05 +0000)
commitdb11c0597508a92cf7a317f16c0fdee65befa266
tree43ec11d68586c6c45c122d71b301db45a27c8b9b
parent1b9cdbe03833eeed13c547ac44933bc107a0c901
MFC r351348 (by markj):
Modify pipe_poll() to properly check for pending direct writes.

With r349546, it is a responsibility of the writer to clear PIPE_DIRECTW
after pinned data has been read.  In particular, once a reader has
drained this data, there is a small window where the pipe is empty but
PIPE_DIRECTW is set.  pipe_poll() was using the presence of PIPE_DIRECTW
to determine whether to return POLLIN, so in this window it would
claim that data was available to read when this was not the case.

Fix this by modifying several checks for PIPE_DIRECTW to instead look
at the number of residual bytes in data pinned by a direct writer.  In
some cases we really do want to check for PIPE_DIRECTW, since the
presence of this flag indicates that any attempt to write to the pipe
will block on the existing direct writer.
sys/kern/sys_pipe.c