sctp: Wake up all processes after closing the connection
Subsystems (2)
PATCH 1/1 sctp: Wake up all processes after closing the connection
All waiters need to be woken up after a state change to ESTABLISHED, CLOSED or SHUTDOWN_RECEIVED, as that's the time when they all should react - for example all threads blocked in send() must return an error when the connection is closed, not only one of them.
This solves the problem of threads sleeping indefinitely in sctp_sendmsg_to_asoc() when the connection was closed while multiple threads were waiting for SNDBUF.
--- net/sctp/sm_sideeffect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/sctp/sm_sideeffect.c +2 -2
@@ -892,11 +892,11 @@ static void sctp_cmd_new_state(struct sctp_cmd_seq *cmds,if (sctp_state (asoc,ESTABLISHED ) ||sctp_state (asoc,CLOSED ) ||sctp_state (asoc,SHUTDOWN_RECEIVED )) { -/* Wake up any processes waiting in the asoc's wait queue in +/* Wake up all processes waiting in the asoc's wait queue in * sctp_wait_for_connect() or sctp_wait_for_sndbuf(). */ if (waitqueue_active (&asoc->wait)) -wake_up_interruptible (&asoc->wait); +wake_up_interruptible_all (&asoc->wait);/* Wake up any processes waiting in the sk's sleep queue of * a TCP-style or UDP-style peeled-off socket in
Signature · 1 line
2.20.1
Quoted 10 lines · Petr Malat
All waiters need to be woken up after a state change to ESTABLISHED, CLOSED or
SHUTDOWN_RECEIVED, as that's the time when they all should react - for example all threads blocked insend()must return an error when the connection is closed, not only one of them.This solves the problem of threads sleeping indefinitely in
sctp_sendmsg_to_asoc()when the connection was closed while multiple threads were waiting for SNDBUF.Signed-off-by Petr Malat <[email protected]>
Thanks.