]> git.baikalelectronics.ru Git - kernel.git/commit
tcp: remove empty skb from write queue in error cases
authorEric Dumazet <edumazet@google.com>
Mon, 26 Aug 2019 16:19:15 +0000 (09:19 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 28 Aug 2019 03:57:43 +0000 (20:57 -0700)
commita5d73e087fb520d40dfb81e13d5fcbb571ded550
treeec29c0b7fcdb6539c7df8a05dcce84ecded0fba3
parentb0618119b851e40c27aed3667df72bdfcb7fbfd0
tcp: remove empty skb from write queue in error cases

Vladimir Rutsky reported stuck TCP sessions after memory pressure
events. Edge Trigger epoll() user would never receive an EPOLLOUT
notification allowing them to retry a sendmsg().

Jason tested the case of sk_stream_alloc_skb() returning NULL,
but there are other paths that could lead both sendmsg() and sendpage()
to return -1 (EAGAIN), with an empty skb queued on the write queue.

This patch makes sure we remove this empty skb so that
Jason code can detect that the queue is empty, and
call sk->sk_write_space(sk) accordingly.

Fixes: dcfac0c9d509 ("tcp: ensure epoll edge trigger wakeup when write queue is empty")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Jason Baron <jbaron@akamai.com>
Reported-by: Vladimir Rutsky <rutsky@google.com>
Cc: Soheil Hassas Yeganeh <soheil@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp.c