]> CyberLeo.Net >> Repos - FreeBSD/stable/8.git/commit
Increment fi_wgen before awakening threads polling the read socket of a
authorjhb <jhb@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Tue, 18 Mar 2014 17:17:42 +0000 (17:17 +0000)
committerjhb <jhb@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Tue, 18 Mar 2014 17:17:42 +0000 (17:17 +0000)
commit4c6dcf314635124a46663edaed8d483c6cc7619c
tree8147b97bb168207da318988389ade1446561d6ae
parent4db88aa421aaf12f43ea2c522c87852d0d1f74e4
Increment fi_wgen before awakening threads polling the read socket of a
FIFO.  Previously, a thread sleeping in poll() could be awakened and
re-poll the FIFO with the old value of fi_wgen (and thus improperly
setting POLLINIGNEOF) before a thread closing a writable fifo descriptor
bumped fi_wgen.  The end result was that the reading thread in poll()
would never see POLLHUP but could block forever (or until a timeout).

This is a direct commit to 8 and 9 since the FIFO code is implemented
differently in 10.x and later.  The pipe-backed FIFOs in 10 do not have
this bug.

git-svn-id: svn://svn.freebsd.org/base/stable/8@263309 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/fs/fifofs/fifo_vnops.c