diff options
author | Ying Xue <ying.xue@windriver.com> | 2012-10-29 14:38:15 +0100 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2012-11-22 02:06:29 +0100 |
commit | 7503115107e5862870eaf5133627051b2e23ac0a (patch) | |
tree | 162b06a086e3adffc182da349179b9a69de89f21 /net/tipc/socket.c | |
parent | tipc: return POLLOUT for sockets in an unconnected state (diff) | |
download | linux-7503115107e5862870eaf5133627051b2e23ac0a.tar.xz linux-7503115107e5862870eaf5133627051b2e23ac0a.zip |
tipc: wake up all waiting threads at socket shutdown
When a socket is shut down, we should wake up all thread sleeping on
it, instead of just one of them. Otherwise, when several threads are
polling the same socket, and one of them does shutdown(), the
remaining threads may end up sleeping forever.
Also, to align socket usage with common practice in other stacks, we
use one of the common socket callback handlers, sk_state_change(),
to wake up pending users. This is similar to the usage in e.g.
inet_shutdown(). [net/ipv4/af_inet.c].
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r-- | net/tipc/socket.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 59adc76905e0..1a720c86e80a 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -1595,10 +1595,11 @@ restart: case SS_DISCONNECTING: - /* Discard any unreceived messages; wake up sleeping tasks */ + /* Discard any unreceived messages */ discard_rx_queue(sk); - if (waitqueue_active(sk_sleep(sk))) - wake_up_interruptible(sk_sleep(sk)); + + /* Wake up anyone sleeping in poll */ + sk->sk_state_change(sk); res = 0; break; |