diff options
author | WANG Cong <xiyou.wangcong@gmail.com> | 2016-11-11 13:20:50 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-11-14 13:17:21 -0500 |
commit | d9dc8b0f8b4ec8cdc48ad5a20a3105387138be82 (patch) | |
tree | a28c86da1c3ba7fef0f3fa82a5c7fc5bbb6fe2bf /include/net/sock.h | |
parent | 7d384846b9987f7b611357adf3cdfecfdcf0c402 (diff) |
net: fix sleeping for sk_wait_event()
Similar to commit 14135f30e33c ("inet: fix sleeping inside inet_wait_for_connect()"),
sk_wait_event() needs to fix too, because release_sock() is blocking,
it changes the process state back to running after sleep, which breaks
the previous prepare_to_wait().
Switch to the new wait API.
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/sock.h')
-rw-r--r-- | include/net/sock.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index cf617ee16723..9d905ed0cd25 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -915,14 +915,16 @@ static inline void sock_rps_reset_rxhash(struct sock *sk) | |||
915 | #endif | 915 | #endif |
916 | } | 916 | } |
917 | 917 | ||
918 | #define sk_wait_event(__sk, __timeo, __condition) \ | 918 | #define sk_wait_event(__sk, __timeo, __condition, __wait) \ |
919 | ({ int __rc; \ | 919 | ({ int __rc; \ |
920 | release_sock(__sk); \ | 920 | release_sock(__sk); \ |
921 | __rc = __condition; \ | 921 | __rc = __condition; \ |
922 | if (!__rc) { \ | 922 | if (!__rc) { \ |
923 | *(__timeo) = schedule_timeout(*(__timeo)); \ | 923 | *(__timeo) = wait_woken(__wait, \ |
924 | TASK_INTERRUPTIBLE, \ | ||
925 | *(__timeo)); \ | ||
924 | } \ | 926 | } \ |
925 | sched_annotate_sleep(); \ | 927 | sched_annotate_sleep(); \ |
926 | lock_sock(__sk); \ | 928 | lock_sock(__sk); \ |
927 | __rc = __condition; \ | 929 | __rc = __condition; \ |
928 | __rc; \ | 930 | __rc; \ |