]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
sctp: flush out queue once assoc state falls into SHUTDOWN_PENDING
authorXin Long <lucien.xin@gmail.com>
Sat, 18 Feb 2017 17:52:45 +0000 (01:52 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 20 Feb 2017 15:26:09 +0000 (10:26 -0500)
This patch is to flush out queue when assoc state falls into
SHUTDOWN_PENDING if there are still chunks in it, so that the
data can be sent out as soon as possible before sending SHUTDOWN
chunk.

When sctp supports MSG_MORE flag in next patch, this improvement
can also solve the problem that the chunks with MSG_MORE flag
may be stuck in queue when closing an assoc.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sctp/sm_sideeffect.c

index 51abcc90fe75d47ab16d717102b82780022d88a7..25384fa82ba99d06f8cb6572be8cecbf1ff4cbbe 100644 (file)
@@ -872,6 +872,10 @@ static void sctp_cmd_new_state(sctp_cmd_seq_t *cmds,
                if (!sctp_style(sk, UDP))
                        sk->sk_state_change(sk);
        }
+
+       if (sctp_state(asoc, SHUTDOWN_PENDING) &&
+           !sctp_outq_is_empty(&asoc->outqueue))
+               sctp_outq_uncork(&asoc->outqueue, GFP_ATOMIC);
 }
 
 /* Helper function to delete an association. */