Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@kernel.org>
To: Sagi Grimberg <sagi@grimberg.me>
Cc: Christoph Hellwig <hch@lst.de>, Keith Busch <kbusch@kernel.org>,
	linux-nvme@lists.infradead.org, Hannes Reinecke <hare@kernel.org>
Subject: [PATCH 3/3] nvme-tcp: fix I/O stalls on congested sockets
Date: Fri,  7 Mar 2025 14:28:02 +0100	[thread overview]
Message-ID: <20250307132802.111513-4-hare@kernel.org> (raw)
In-Reply-To: <20250307132802.111513-1-hare@kernel.org>

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>
---
 drivers/nvme/host/tcp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 073c8c3538fd..d39d955bad99 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -1357,9 +1357,12 @@ static void nvme_tcp_io_work(struct work_struct *w)
 		result = nvme_tcp_try_recv(queue);
 		if (result > 0)
 			pending = true;
-		else if (unlikely(result < 0))
+		else if (unlikely(result < 0) && result != -EAGAIN)
 			return;
 
+		if (nvme_tcp_queue_has_pending(queue))
+			pending = true;
+
 		if (!pending || !queue->rd_enabled)
 			return;
 
-- 
2.35.3



  parent reply	other threads:[~2025-03-07 13:29 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-07 13:27 [PATCH 0/3] nvme-tcp: fixup I/O stall on congested sockets Hannes Reinecke
2025-03-07 13:28 ` [PATCH 1/3] nvme-tcp: avoid inline sending when handling R2T PDUs Hannes Reinecke
2025-03-11 18:40   ` Chris Leech
2025-03-12  8:14     ` Hannes Reinecke
2025-03-07 13:28 ` [PATCH 2/3] nvme-tcp: sanitize request list handling Hannes Reinecke
2025-03-11 18:53   ` Chris Leech
2025-03-12  8:16     ` Hannes Reinecke
2025-03-12 12:27       ` Maurizio Lombardi
2025-03-07 13:28 ` Hannes Reinecke [this message]
2025-03-11 18:55   ` [PATCH 3/3] nvme-tcp: fix I/O stalls on congested sockets Chris Leech
2025-03-10 17:02 ` [PATCH 0/3] nvme-tcp: fixup I/O stall " Keith Busch
  -- strict thread matches above, loose matches on Subject: below --
2025-04-03  6:55 [PATCHv3 " Hannes Reinecke
2025-04-03  6:55 ` [PATCH 3/3] nvme-tcp: fix I/O stalls " Hannes Reinecke
2025-04-13 23:09   ` Sagi Grimberg
2025-04-14  6:21     ` Hannes Reinecke
2025-04-14 20:24       ` Sagi Grimberg
2025-04-15  7:07   ` Hannes Reinecke
2025-04-15 21:35     ` Sagi Grimberg
2025-04-16  7:56       ` Hannes Reinecke
2025-04-16 22:09         ` Sagi Grimberg
2025-04-17 23:03           ` Kamaljit Singh
2025-04-17 23:06             ` Kamaljit Singh
2025-04-18 10:51             ` Sagi Grimberg
2025-04-18 18:55               ` Kamaljit Singh
2025-04-19 16:10                 ` Sagi Grimberg
2025-04-21 19:11                   ` Kamaljit Singh
2025-04-22 11:43                     ` Sagi Grimberg
2025-04-23 17:26                       ` Kamaljit Singh
2025-04-24 11:26           ` Hannes Reinecke
2025-04-25 21:55             ` Sagi Grimberg
2025-04-25 22:09               ` Sagi Grimberg
2025-04-25 23:47                 ` Kamaljit Singh
2025-04-27 10:35                   ` Sagi Grimberg
     [not found]                     ` <BY5PR04MB6849D4BF87755B82A073BBDABC89A@BY5PR04MB6849.namprd04.prod.outlook.com>
2025-05-06 18:05                       ` Hannes Reinecke
2025-05-07 22:26                         ` Kamaljit Singh
2025-05-08 21:23                           ` Kamaljit Singh
2025-05-09  6:52                             ` Hannes Reinecke
2025-05-09  8:58                               ` Hannes Reinecke
2025-05-11  9:12                               ` Sagi Grimberg
2025-05-11  9:11                             ` Sagi Grimberg
2025-05-13 19:24                               ` Kamaljit Singh
2025-05-14  6:35                                 ` Hannes Reinecke
2025-05-17 10:01                                   ` Sagi Grimberg
2025-05-17 10:12                                     ` Sagi Grimberg
2025-05-27 21:49                                       ` Sagi Grimberg
2025-05-28  1:43                                         ` Kamaljit Singh
2025-05-28  6:33                                           ` Hannes Reinecke
2025-05-28 22:45                                             ` Kamaljit Singh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250307132802.111513-4-hare@kernel.org \
    --to=hare@kernel.org \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox