[PATCH V4 2/2] nvme-tcp: do not complete the request if send operation fails
Maurizio Lombardi
mlombard at redhat.com
Fri Apr 4 01:28:01 PDT 2025
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 at cestc.cn>
Fixes: 3f2304f8c6d6 ("nvme-tcp: add NVMe over TCP host driver")
Signed-off-by: Maurizio Lombardi <mlombard at 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
More information about the Linux-nvme
mailing list