diff options
author | Xin Long <lucien.xin@gmail.com> | 2018-10-17 03:07:51 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-10-18 11:23:47 -0700 |
commit | cd305c74b0f8b49748a79a8f67fc8e5e3e0c4794 (patch) | |
tree | 5e3af28184fb65447c9aaeffa51bfb95f473667a /net/sctp/proc.c | |
parent | 605c0ac182c34867bda71bfbcc74958aabbe2fe0 (diff) | |
download | linux-cd305c74b0f8b49748a79a8f67fc8e5e3e0c4794.tar.bz2 |
sctp: use sk_wmem_queued to check for writable space
sk->sk_wmem_queued is used to count the size of chunks in out queue
while sk->sk_wmem_alloc is for counting the size of chunks has been
sent. sctp is increasing both of them before enqueuing the chunks,
and using sk->sk_wmem_alloc to check for writable space.
However, sk_wmem_alloc is also increased by 1 for the skb allocked
for sending in sctp_packet_transmit() but it will not wake up the
waiters when sk_wmem_alloc is decreased in this skb's destructor.
If msg size is equal to sk_sndbuf and sendmsg is waiting for sndbuf,
the check 'msg_len <= sctp_wspace(asoc)' in sctp_wait_for_sndbuf()
will keep waiting if there's a skb allocked in sctp_packet_transmit,
and later even if this skb got freed, the waiting thread will never
get waked up.
This issue has been there since very beginning, so we change to use
sk->sk_wmem_queued to check for writable space as sk_wmem_queued is
not increased for the skb allocked for sending, also as TCP does.
SOCK_SNDBUF_LOCK check is also removed here as it's for tx buf auto
tuning which I will add in another patch.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/proc.c')
0 files changed, 0 insertions, 0 deletions