From: Maurizio Lombardi <mlombard@redhat.com>
To: kbusch@meta.com
Cc: hare@kernel.org, sagi@grimberg.me,
linux-nvme@lists.infradead.org, mlombard@bsdbackstore.eu,
zhang.guanghui@cestc.cn, loberman@redhat.com
Subject: [PATCH V4 2/2] nvme-tcp: do not complete the request if send operation fails
Date: Fri, 4 Apr 2025 10:28:01 +0200 [thread overview]
Message-ID: <20250404082801.1614252-3-mlombard@redhat.com> (raw)
In-Reply-To: <20250404082801.1614252-1-mlombard@redhat.com>
In some cases, the send operation may fail even though
the command is successfully received by the target.
The target then sends a command completion capsule back to the host,
leading to double completion and a kernel panic.
To prevent this, do not fail the request; instead, let the
error recovery mechanism clean everything up.
Tested-by: Zhang Guanghui <zhang.guanghui@cestc.cn>
Fixes: 3f2304f8c6d6 ("nvme-tcp: add NVMe over TCP host driver")
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
---
drivers/nvme/host/tcp.c | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index f1e2b0417b39..726f24a352fe 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -1101,19 +1101,6 @@ static inline void nvme_tcp_done_send_req(struct nvme_tcp_queue *queue)
queue->request = NULL;
}
-static void nvme_tcp_fail_request(struct nvme_tcp_request *req)
-{
- if (nvme_tcp_async_req(req)) {
- union nvme_result res = {};
-
- nvme_complete_async_event(&req->queue->ctrl->ctrl,
- cpu_to_le16(NVME_SC_HOST_PATH_ERROR), &res);
- } else {
- nvme_tcp_end_request(blk_mq_rq_from_pdu(req),
- NVME_SC_HOST_PATH_ERROR);
- }
-}
-
static int nvme_tcp_try_send_data(struct nvme_tcp_request *req)
{
struct nvme_tcp_queue *queue = req->queue;
@@ -1327,7 +1314,6 @@ static int nvme_tcp_try_send(struct nvme_tcp_queue *queue)
} else if (ret < 0) {
dev_err(queue->ctrl->ctrl.device,
"failed to send request %d\n", ret);
- nvme_tcp_fail_request(queue->request);
nvme_tcp_done_send_req(queue);
nvme_tcp_error_recovery(&queue->ctrl->ctrl);
}
--
2.43.5
next prev parent reply other threads:[~2025-04-04 8:28 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-04 8:27 [PATCH V4 0/2] Fix race conditions in the nvme-tcp driver Maurizio Lombardi
2025-04-04 8:28 ` [PATCH V4 1/2] nvme-tcp: Prevent infinite loop if socket closes during CONNECTING state Maurizio Lombardi
2025-04-05 23:22 ` Keith Busch
2025-04-07 6:11 ` Hannes Reinecke
2025-04-13 22:44 ` Sagi Grimberg
2025-04-14 7:25 ` Maurizio Lombardi
2025-04-14 21:35 ` Sagi Grimberg
2025-04-17 13:04 ` Maurizio Lombardi
2025-04-18 11:14 ` Sagi Grimberg
2025-06-10 12:50 ` Maurizio Lombardi
2025-06-10 14:29 ` Sagi Grimberg
[not found] ` <202510211137214079503@cestc.cn>
2025-10-21 6:05 ` [PATCH V4 1/2] nvme-tcp: Prevent infinite loop if socket closes during CONNECTING state【请注意,邮件由sagigrim@gmail.com代发】 Maurizio Lombardi
2025-10-21 6:14 ` Maurizio Lombardi
2025-04-04 8:28 ` Maurizio Lombardi [this message]
2025-04-05 23:23 ` [PATCH V4 2/2] nvme-tcp: do not complete the request if send operation fails Keith Busch
2025-04-07 6:13 ` Hannes Reinecke
2025-04-11 12:26 ` [PATCH V4 0/2] Fix race conditions in the nvme-tcp driver Maurizio Lombardi
2025-04-13 22:42 ` Sagi Grimberg
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=20250404082801.1614252-3-mlombard@redhat.com \
--to=mlombard@redhat.com \
--cc=hare@kernel.org \
--cc=kbusch@meta.com \
--cc=linux-nvme@lists.infradead.org \
--cc=loberman@redhat.com \
--cc=mlombard@bsdbackstore.eu \
--cc=sagi@grimberg.me \
--cc=zhang.guanghui@cestc.cn \
/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;
as well as URLs for NNTP newsgroup(s).