nvme-tcp: fix I/O stalls on congested sockets
[ Upstream commit f42d4796ee100fade86086d1cf98537fb4d326c8 ] 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 <hare@kernel.org> Acked-by: Chris Leech <cleech@redhat.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
519ab9c725
commit
7b86ce1670
@@ -1349,7 +1349,7 @@ static int nvme_tcp_try_recv(struct nvme_tcp_queue *queue)
|
|||||||
queue->nr_cqe = 0;
|
queue->nr_cqe = 0;
|
||||||
consumed = sock->ops->read_sock(sk, &rd_desc, nvme_tcp_recv_skb);
|
consumed = sock->ops->read_sock(sk, &rd_desc, nvme_tcp_recv_skb);
|
||||||
release_sock(sk);
|
release_sock(sk);
|
||||||
return consumed;
|
return consumed == -EAGAIN ? 0 : consumed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nvme_tcp_io_work(struct work_struct *w)
|
static void nvme_tcp_io_work(struct work_struct *w)
|
||||||
@@ -1377,6 +1377,11 @@ static void nvme_tcp_io_work(struct work_struct *w)
|
|||||||
else if (unlikely(result < 0))
|
else if (unlikely(result < 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* did we get some space after spending time in recv? */
|
||||||
|
if (nvme_tcp_queue_has_pending(queue) &&
|
||||||
|
sk_stream_is_writeable(queue->sock->sk))
|
||||||
|
pending = true;
|
||||||
|
|
||||||
if (!pending || !queue->rd_enabled)
|
if (!pending || !queue->rd_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user