Commit 2c6607c611cb7bf0a6750bcea34a258144e302c5

Authored by Eric Dumazet
Committed by David S. Miller
1 parent 3610cda53f

net: add POLLPRI to sock_def_readable()

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>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

... ... @@ -1908,7 +1908,7 @@
1908 1908 rcu_read_lock();
1909 1909 wq = rcu_dereference(sk->sk_wq);
1910 1910 if (wq_has_sleeper(wq))
1911   - wake_up_interruptible_sync_poll(&wq->wait, POLLIN |
  1911 + wake_up_interruptible_sync_poll(&wq->wait, POLLIN | POLLPRI |
1912 1912 POLLRDNORM | POLLRDBAND);
1913 1913 sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN);
1914 1914 rcu_read_unlock();