All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sctp: Wake up all processes after closing the connection
@ 2020-07-02  8:01 Petr Malat
  2020-07-02 12:55 ` Marcelo Ricardo Leitner
  0 siblings, 1 reply; 2+ messages in thread
From: Petr Malat @ 2020-07-02  8:01 UTC (permalink / raw)
  To: linux-sctp

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.

Signed-off-by: Petr Malat <oss@malat.biz>
---
 net/sctp/sm_sideeffect.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index 9f36fe911d08..ae08b1805b45 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -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
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sctp: Wake up all processes after closing the connection
  2020-07-02  8:01 [PATCH] sctp: Wake up all processes after closing the connection Petr Malat
@ 2020-07-02 12:55 ` Marcelo Ricardo Leitner
  0 siblings, 0 replies; 2+ messages in thread
From: Marcelo Ricardo Leitner @ 2020-07-02 12:55 UTC (permalink / raw)
  To: linux-sctp

On Thu, Jul 02, 2020 at 10:01:26AM +0200, Petr Malat wrote:
> 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.
> 
> Signed-off-by: Petr Malat <oss@malat.biz>

Thanks.

Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-02 12:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-02  8:01 [PATCH] sctp: Wake up all processes after closing the connection Petr Malat
2020-07-02 12:55 ` Marcelo Ricardo Leitner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.