tcp: ensure epoll edge trigger wakeup when write queue is empty
authorJason Baron <jbaron@akamai.com>
Wed, 20 May 2015 15:52:53 +0000 (15:52 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 21 May 2015 22:52:47 +0000 (18:52 -0400)
commitce5ec440994b7b2b714633b516b9e0a4f6a98dfe
tree622bb4c672fac69573cd9b2d31c6cbb367ac4f3a
parentb92d581499417556c3baa8161d1f983f96610939
tcp: ensure epoll edge trigger wakeup when write queue is empty

We currently rely on the setting of SOCK_NOSPACE in the write()
path to ensure that we wake up any epoll edge trigger waiters when
acks return to free space in the write queue. However, if we fail
to allocate even a single skb in the write queue, we could end up
waiting indefinitely.

Fix this by explicitly issuing a wakeup when we detect the condition
of an empty write queue and a return value of -EAGAIN. This allows
userspace to re-try as we expect this to be a temporary failure.

I've tested this approach by artificially making
sk_stream_alloc_skb() return NULL periodically. In that case,
epoll edge trigger waiters will hang indefinitely in epoll_wait()
without this patch.

Signed-off-by: Jason Baron <jbaron@akamai.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp.c
This page took 0.025716 seconds and 5 git commands to generate.