net: add POLLPRI to sock_def_readable()
commited12313af40575c71b1b6533576f6d5dd9cc39b0
authorEric Dumazet <eric.dumazet@gmail.com>
Thu, 6 Jan 2011 18:54:29 +0000 (6 10:54 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 17 Feb 2011 23:14:23 +0000 (17 15:14 -0800)
tree554993a45a3fa80f793a1f6db2eb83ce3fc34db4
parent3e7e81d9e842ba49fbe4abdc173fac61c9b14181
net: add POLLPRI to sock_def_readable()

[ Upstream commit 2c6607c611cb7bf0a6750bcea34a258144e302c5 ]

Leonardo Chiquitto found poll() could block forever on tcp sockets and
Urgent data was received, if the event flag only contains POLLPRI.

He did a bisection and found commit 4938d7e0233 (poll: avoid extra
wakeups in select/poll) was the source of the problem.

Problem is TCP sockets use standard sock_def_readable() function for
their sk_data_ready() handler, and sock_def_readable() doesnt signal
POLLPRI.

Only TCP is affected by the problem. Adding POLLPRI to the list of flags
might trigger unnecessary schedules, but URGENT handling is such a
seldom used feature this seems a good compromise.

Thanks a lot to Leonardo for providing the bisection result and a test
program as well.

Reference : http://www.spinics.net/lists/netdev/msg151793.html

Reported-and-bisected-by: Leonardo Chiquitto <leonardo.lists@gmail.com>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Tested-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/core/sock.c