net: fix sleeping for sk_wait_event()
Similar to commit 14135f30e3
("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>
This commit is contained in:

committed by
David S. Miller

parent
7d384846b9
commit
d9dc8b0f8b
@@ -1167,7 +1167,7 @@ disabled:
|
||||
/* Wait until flow control allows TX */
|
||||
done = atomic_read(&pn->tx_credits);
|
||||
while (!done) {
|
||||
DEFINE_WAIT(wait);
|
||||
DEFINE_WAIT_FUNC(wait, woken_wake_function);
|
||||
|
||||
if (!timeo) {
|
||||
err = -EAGAIN;
|
||||
@@ -1178,10 +1178,9 @@ disabled:
|
||||
goto out;
|
||||
}
|
||||
|
||||
prepare_to_wait(sk_sleep(sk), &wait,
|
||||
TASK_INTERRUPTIBLE);
|
||||
done = sk_wait_event(sk, &timeo, atomic_read(&pn->tx_credits));
|
||||
finish_wait(sk_sleep(sk), &wait);
|
||||
add_wait_queue(sk_sleep(sk), &wait);
|
||||
done = sk_wait_event(sk, &timeo, atomic_read(&pn->tx_credits), &wait);
|
||||
remove_wait_queue(sk_sleep(sk), &wait);
|
||||
|
||||
if (sk->sk_state != TCP_ESTABLISHED)
|
||||
goto disabled;
|
||||
|
Reference in New Issue
Block a user