]> git.baikalelectronics.ru Git - kernel.git/commit
Fix broken "pipe: use event aware wakeups" optimization
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 21 Jan 2011 00:21:59 +0000 (16:21 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 21 Jan 2011 00:21:59 +0000 (16:21 -0800)
commite6131321a49aee53a603dc8890f1f7e0121e6863
treeb9191d7e213ad6e8ceb43d45e3306ced085b04f7
parentddef9c1c9a50382f1f17275b876175ada3e9edea
Fix broken "pipe: use event aware wakeups" optimization

Commit d71356d95fd2 ("pipe: use event aware wakeups") optimized the pipe
event wakeup calls to avoid wakeups if the events do not match the
requested set.

However, the optimization was buggy, in that it didn't actually use the
correct sets for the events: when we make room for more data to be
written, the pipe poll() routine will return both the POLLOUT _and_
POLLWRNORM bits.  Similarly for read.

And most critically, when a pipe is released, that will potentially
result in POLLHUP|POLLERR (depending on whether it was the last reader
or writer), not just the regular POLLIN|POLLOUT.

This bug showed itself as a hung gnome-screensaver-dialog process, stuck
forever (or at least until it was poked by a signal or by being traced)
in a poll() system call.

Cc: Davide Libenzi <davidel@xmailserver.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/pipe.c