Skip to contentSkip to conversation

nvme-tcp: fix bogus request completion when failing to send AER

PATCH Applied Sagi Grimberg 3 participants 3 messages Feb 6, 2022 – Feb 9, 2022 NVMe

lore
Share & tools
lore

Sagi Grimberg

author maintainer
#0 lore raw

PATCH 1/1 nvme-tcp: fix bogus request completion when failing to send AER

AER is not backed by a real request, hence we should not incorrectly assume that when failing to send a nvme command, it is a normal request but rather check if this is an aer and if so complete the aer (similar to the normal completion path).

---
 drivers/nvme/host/tcp.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/nvme/host/tcp.c +9 -1
index 01e24b5703db..1096a0b0a268 100644
@@ -913,7 +913,15 @@ static inline void nvme_tcp_done_send_req(struct nvme_tcp_queue *queue)
 
 static void nvme_tcp_fail_request(struct nvme_tcp_request *req)
 {
-	nvme_tcp_end_request(blk_mq_rq_from_pdu(req), NVME_SC_HOST_PATH_ERROR);
+	if (nvme_tcp_async_req(req)) {
+		union nvme_result res = {};
+
+		nvme_complete_async_event(&req->queue->ctrl->ctrl,
+			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)
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 22 lines · Sagi Grimberg

AER is not backed by a real request, hence we should not incorrectly assume that when failing to send a nvme command, it is a normal request but rather check if this is an aer and if so complete the aer (similar to the normal completion path).

---
  drivers/nvme/host/tcp.c | 10 +++++++++-
  1 file changed, 9 insertions(+), 1 deletion(-)
drivers/nvme/host/tcp.c +2 -1
index 01e24b5703db..1096a0b0a268 100644
@@ -913,7 +913,15 @@ static inline void nvme_tcp_done_send_req(struct nvme_tcp_queue *queue)
 
  static void nvme_tcp_fail_request(struct nvme_tcp_request *req)
  {
-	nvme_tcp_end_request(blk_mq_rq_from_pdu(req), NVME_SC_HOST_PATH_ERROR);
+	if (nvme_tcp_async_req(req)) {
+		union nvme_result res = {};

drivers/nvme/host/tcp.c static inline void nvme_tcp_done_send_req(struct nvme_tcp_queue *queue) · line 927

Quoted 10 lines
drivers/nvme/host/tcp.c +7 -0
+
+		nvme_complete_async_event(&req->queue->ctrl->ctrl,
+			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)

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke		           Kernel Storage Architect
[email protected]			                  +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Felix Imendörffer