From: Eric Dumazet Date: Thu, 6 Jan 2011 18:54:29 +0000 (-0800) Subject: net: add POLLPRI to sock_def_readable() X-Git-Tag: v2.6.38-rc1~476^2~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2c6607c611cb7bf0a6750bcea34a258144e302c5;p=platform%2Fupstream%2Fkernel-adaptation-pc.git 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 Signed-off-by: Eric Dumazet Tested-by: Eric Dumazet Signed-off-by: David S. Miller --- diff --git a/net/core/sock.c b/net/core/sock.c index a6b9e80..a658aeb 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1908,7 +1908,7 @@ static void sock_def_readable(struct sock *sk, int len) rcu_read_lock(); wq = rcu_dereference(sk->sk_wq); if (wq_has_sleeper(wq)) - wake_up_interruptible_sync_poll(&wq->wait, POLLIN | + wake_up_interruptible_sync_poll(&wq->wait, POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND); sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN); rcu_read_unlock();