tcp: flush DMA queue before sk_wait_data if rcv_wnd is zero
authorMichal Kubeček <mkubecek@suse.cz>
Fri, 14 Sep 2012 04:59:52 +0000 (04:59 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 19 Sep 2012 20:07:58 +0000 (16:07 -0400)
commit15c041759bfcd9ab0a4e43f1c16e2644977d0467
treec530b3395136fc4c29ff022200adf5d948ce5bc8
parentdbd6b11e15a2f96030da17dbeda943a8a98ee990
tcp: flush DMA queue before sk_wait_data if rcv_wnd is zero

If recv() syscall is called for a TCP socket so that
  - IOAT DMA is used
  - MSG_WAITALL flag is used
  - requested length is bigger than sk_rcvbuf
  - enough data has already arrived to bring rcv_wnd to zero
then when tcp_recvmsg() gets to calling sk_wait_data(), receive
window can be still zero while sk_async_wait_queue exhausts
enough space to keep it zero. As this queue isn't cleaned until
the tcp_service_net_dma() call, sk_wait_data() cannot receive
any data and blocks forever.

If zero receive window and non-empty sk_async_wait_queue is
detected before calling sk_wait_data(), process the queue first.

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp.c