Skip to content

Commit f42d479

Browse files
Hannes ReineckeChristoph Hellwig
authored andcommitted
nvme-tcp: fix I/O stalls on congested sockets
When the socket is busy processing nvme_tcp_try_recv() might return -EAGAIN, but this doesn't automatically imply that the sending side is blocked, too. So check if there are pending requests once nvme_tcp_try_recv() returns -EAGAIN and continue with the sending loop to avoid I/O stalls. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Chris Leech <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent 0bf04c8 commit f42d479

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/nvme/host/tcp.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,7 @@ static int nvme_tcp_try_recv(struct nvme_tcp_queue *queue)
13611361
queue->nr_cqe = 0;
13621362
consumed = sock->ops->read_sock(sk, &rd_desc, nvme_tcp_recv_skb);
13631363
release_sock(sk);
1364-
return consumed;
1364+
return consumed == -EAGAIN ? 0 : consumed;
13651365
}
13661366

13671367
static void nvme_tcp_io_work(struct work_struct *w)
@@ -1389,6 +1389,11 @@ static void nvme_tcp_io_work(struct work_struct *w)
13891389
else if (unlikely(result < 0))
13901390
return;
13911391

1392+
/* did we get some space after spending time in recv? */
1393+
if (nvme_tcp_queue_has_pending(queue) &&
1394+
sk_stream_is_writeable(queue->sock->sk))
1395+
pending = true;
1396+
13921397
if (!pending || !queue->rd_enabled)
13931398
return;
13941399

0 commit comments

Comments
 (0)