Skip to contentSkip to conversation

nvme completion handling refactor and fix v2

PATCH In review Christoph Hellwig 3 participants 16 messages Aug 17, 2020 – Aug 18, 2020

Subsystems (5)
lore
Share & tools
lore

Christoph Hellwig

author maintainer
#0 lore raw

Hi all,

the first two patches refactor the common nvme completion code to be a little less obsfucated, and the third one is the fix from Chao to redirect to a different path ported on top of these changes, which now make the fix very simple.

Changes since v1:
- add a new patch to handle the path related errors using the SCT class

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

author maintainer
#1 lore raw

PATCH 1/4 nvme: rename and document nvme_end_request

nvme_end_request is a bit misnamed, as it wraps around the blk_mq_complete_* API. It's semantics also are non-trivial, so give it a more descriptive name and add a comment explaining the semantics.

---
 Documentation/fault-injection/nvme-fault-injection.rst | 2 +-
 drivers/nvme/host/fc.c                                 | 2 +-
 drivers/nvme/host/nvme.h                               | 8 +++++++-
 drivers/nvme/host/pci.c                                | 2 +-
 drivers/nvme/host/rdma.c                               | 2 +-
 drivers/nvme/host/tcp.c                                | 4 ++--
 drivers/nvme/target/loop.c                             | 2 +-
 7 files changed, 14 insertions(+), 8 deletions(-)
Documentation/fault-injection/nvme-fault-injection.rst +1 -1
index cdb2e829228e3e..1d4427890d7591 100644
@@ -3,7 +3,7 @@ NVMe Fault Injection
 Linux's fault injection framework provides a systematic way to support
 error injection via debugfs in the /sys/kernel/debug directory. When
 enabled, the default NVME_SC_INVALID_OPCODE with no retry will be
-injected into the nvme_end_request. Users can change the default status
+injected into the nvme_try_complete_req. Users can change the default status
 code and no retry flag via the debugfs. The list of Generic Command
 Status can be found in include/linux/nvme.h
 
drivers/nvme/host/fc.c +1 -1
index eae43bb444e038..ba4f10144274db 100644
@@ -2035,7 +2035,7 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req)
 	}
 
 	__nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate);
-	if (!nvme_end_request(rq, status, result))
+	if (!nvme_try_complete_req(rq, status, result))
 		nvme_fc_complete_rq(rq);
 
 check_error:
drivers/nvme/host/nvme.h +7 -1
index ebb8c3ed388554..6d69cc7306d034 100644
@@ -523,7 +523,13 @@ static inline u32 nvme_bytes_to_numd(size_t len)
 	return (len >> 2) - 1;
 }
 
-static inline bool nvme_end_request(struct request *req, __le16 status,
+/*
+ * Fill in the status and result information from the CQE, and then figure
+ * out if we blk-mq will need to use IPI magic to complete the request, and
+ * if yes do so.  If not let the caller complete the request without an
+ * indirect function call.
+ */
+static inline bool nvme_try_complete_req(struct request *req, __le16 status,
 		union nvme_result result)
 {
 	struct nvme_request *rq = nvme_req(req);
drivers/nvme/host/pci.c +1 -1
index ba725ae47305ef..f96a69bbda70da 100644
@@ -961,7 +961,7 @@ static inline void nvme_handle_cqe(struct nvme_queue *nvmeq, u16 idx)
 
 	req = blk_mq_tag_to_rq(nvme_queue_tagset(nvmeq), cqe->command_id);
 	trace_nvme_sq(req, cqe->sq_head, nvmeq->sq_tail);
-	if (!nvme_end_request(req, cqe->status, cqe->result))
+	if (!nvme_try_complete_req(req, cqe->status, cqe->result))
 		nvme_pci_complete_rq(req);
 }
 
drivers/nvme/host/rdma.c +1 -1
index 44c76ffbb264cd..4c5660201009c5 100644
@@ -1189,7 +1189,7 @@ static void nvme_rdma_end_request(struct nvme_rdma_request *req)
 
 	if (!refcount_dec_and_test(&req->ref))
 		return;
-	if (!nvme_end_request(rq, req->status, req->result))
+	if (!nvme_try_complete_req(rq, req->status, req->result))
 		nvme_rdma_complete_rq(rq);
 }
 
drivers/nvme/host/tcp.c +2 -2
index 62fbaecdc960c3..3be4749dbf1127 100644
@@ -481,7 +481,7 @@ static int nvme_tcp_process_nvme_cqe(struct nvme_tcp_queue *queue,
 		return -EINVAL;
 	}
 
-	if (!nvme_end_request(rq, cqe->status, cqe->result))
+	if (!nvme_try_complete_req(rq, cqe->status, cqe->result))
 		nvme_complete_rq(rq);
 	queue->nr_cqe++;
 
@@ -672,7 +672,7 @@ static inline void nvme_tcp_end_request(struct request *rq, u16 status)
 {
 	union nvme_result res = {};
 
-	if (!nvme_end_request(rq, cpu_to_le16(status << 1), res))
+	if (!nvme_try_complete_req(rq, cpu_to_le16(status << 1), res))
 		nvme_complete_rq(rq);
 }
 
drivers/nvme/target/loop.c +1 -1
index 4884ef1e46a281..0d6008cf66a2ad 100644
@@ -115,7 +115,7 @@ static void nvme_loop_queue_response(struct nvmet_req *req)
 			return;
 		}
 
-		if (!nvme_end_request(rq, cqe->status, cqe->result))
+		if (!nvme_try_complete_req(rq, cqe->status, cqe->result))
 			nvme_loop_complete_rq(rq);
 	}
 }
Signature · 7 lines
2.28.0


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Reviewed-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] nvme: rename and document nvme_end_request

Quoted 47 lines · Christoph Hellwig

nvme_end_request is a bit misnamed, as it wraps around the blk_mq_complete_* API. It's semantics also are non-trivial, so give it a more descriptive name and add a comment explaining the semantics.

---
 Documentation/fault-injection/nvme-fault-injection.rst | 2 +-
 drivers/nvme/host/fc.c                                 | 2 +-
 drivers/nvme/host/nvme.h                               | 8 +++++++-
 drivers/nvme/host/pci.c                                | 2 +-
 drivers/nvme/host/rdma.c                               | 2 +-
 drivers/nvme/host/tcp.c                                | 4 ++--
 drivers/nvme/target/loop.c                             | 2 +-
 7 files changed, 14 insertions(+), 8 deletions(-)
Documentation/fault-injection/nvme-fault-injection.rst +1 -1
index cdb2e829228e3e..1d4427890d7591 100644
@@ -3,7 +3,7 @@ NVMe Fault Injection
 Linux's fault injection framework provides a systematic way to support
 error injection via debugfs in the /sys/kernel/debug directory. When
 enabled, the default NVME_SC_INVALID_OPCODE with no retry will be
-injected into the nvme_end_request. Users can change the default status
+injected into the nvme_try_complete_req. Users can change the default status
 code and no retry flag via the debugfs. The list of Generic Command
 Status can be found in include/linux/nvme.h
 
drivers/nvme/host/fc.c +1 -1
index eae43bb444e038..ba4f10144274db 100644
@@ -2035,7 +2035,7 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req)
 	}
 
 	__nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate);
-	if (!nvme_end_request(rq, status, result))
+	if (!nvme_try_complete_req(rq, status, result))
 		nvme_fc_complete_rq(rq);
 
 check_error:
drivers/nvme/host/nvme.h +0 -0
index ebb8c3ed388554..6d69cc7306d034 100644

drivers/nvme/host/nvme.h static inline u32 nvme_bytes_to_numd(size_t len) · line 528

Quoted 7 lines
drivers/nvme/host/nvme.h +3 -1
@@ -523,7 +523,13 @@ static inline u32 nvme_bytes_to_numd(size_t len)
 	return (len >> 2) - 1;
 }
 
-static inline bool nvme_end_request(struct request *req, __le16 status,
+/*
+ * Fill in the status and result information from the CQE, and then figure
+ * out if we blk-mq will need to use IPI magic to complete the request, and

s/we blk-mq/blk-mq/

Otherwise:

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

author maintainer
#3 lore raw

PATCH 2/4 nvme: refactor command completion

In reply to Christoph Hellwig

Lift all the code to decide the dispostition of a completed command from nvme_complete_rq and nvme_failover_req into a new helper, which returns an emum of the potential actions. nvme_complete_rq then just switches on those and calls the proper helper for the action.

---
 drivers/nvme/host/core.c      | 76 ++++++++++++++++++++++-------------
 drivers/nvme/host/multipath.c | 47 ++++++----------------
 drivers/nvme/host/nvme.h      | 31 ++++++++++++--
 3 files changed, 90 insertions(+), 64 deletions(-)
drivers/nvme/host/core.c +49 -27
index 88cff309d8e4f0..8d474adad721fb 100644
@@ -241,17 +241,6 @@ static blk_status_t nvme_error_status(u16 status)
 	}
 }
 
-static inline bool nvme_req_needs_retry(struct request *req)
-{
-	if (blk_noretry_request(req))
-		return false;
-	if (nvme_req(req)->status & NVME_SC_DNR)
-		return false;
-	if (nvme_req(req)->retries >= nvme_max_retries)
-		return false;
-	return true;
-}
-
 static void nvme_retry_req(struct request *req)
 {
 	struct nvme_ns *ns = req->q->queuedata;
@@ -268,34 +257,67 @@ static void nvme_retry_req(struct request *req)
 	blk_mq_delay_kick_requeue_list(req->q, delay);
 }
 
-void nvme_complete_rq(struct request *req)
+enum nvme_disposition {
+	COMPLETE,
+	RETRY,
+	FAILOVER,
+};
+
+static inline enum nvme_disposition nvme_decide_disposition(struct request *req)
 {
-	blk_status_t status = nvme_error_status(nvme_req(req)->status);
+	u16 status = nvme_req(req)->status & 0x7ff;
 
-	trace_nvme_complete_rq(req);
+	if (likely(status == 0))
+		return COMPLETE;
 
-	nvme_cleanup_cmd(req);
+	if (blk_noretry_request(req) || (status & NVME_SC_DNR) ||
+	    nvme_req(req)->retries >= nvme_max_retries)
+		return COMPLETE;
 
-	if (nvme_req(req)->ctrl->kas)
-		nvme_req(req)->ctrl->comp_seen = true;
+	if (req->cmd_flags & REQ_NVME_MPATH) {
+		if (nvme_is_path_error(status))
+			return FAILOVER;
+	}
 
-	if (unlikely(status != BLK_STS_OK && nvme_req_needs_retry(req))) {
-		if ((req->cmd_flags & REQ_NVME_MPATH) && nvme_failover_req(req))
-			return;
+	if (blk_queue_dying(req->q))
+		return COMPLETE;
 
-		if (!blk_queue_dying(req->q)) {
-			nvme_retry_req(req);
-			return;
-		}
-	} else if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) &&
-		   req_op(req) == REQ_OP_ZONE_APPEND) {
+	return RETRY;
+}
+
+static inline void nvme_end_req(struct request *req)
+{
+	blk_status_t status = nvme_error_status(nvme_req(req)->status);
+
+	if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) &&
+	    req_op(req) == REQ_OP_ZONE_APPEND)
 		req->__sector = nvme_lba_to_sect(req->q->queuedata,
 			le64_to_cpu(nvme_req(req)->result.u64));
-	}
 
 	nvme_trace_bio_complete(req, status);
 	blk_mq_end_request(req, status);
 }
+
+void nvme_complete_rq(struct request *req)
+{
+	trace_nvme_complete_rq(req);
+	nvme_cleanup_cmd(req);
+
+	if (nvme_req(req)->ctrl->kas)
+		nvme_req(req)->ctrl->comp_seen = true;
+
+	switch (nvme_decide_disposition(req)) {
+	case COMPLETE:
+		nvme_end_req(req);
+		return;
+	case RETRY:
+		nvme_retry_req(req);
+		return;
+	case FAILOVER:
+		nvme_failover_req(req);
+		return;
+	}
+}
 EXPORT_SYMBOL_GPL(nvme_complete_rq);
 
 bool nvme_cancel_request(struct request *req, void *data, bool reserved)
drivers/nvme/host/multipath.c +13 -34

64 lines not on this page · raw message

drivers/nvme/host/nvme.h +28 -3
index 6d69cc7306d034..dfcdeb318f3ab6 100644
@@ -523,6 +523,32 @@ static inline u32 nvme_bytes_to_numd(size_t len)
 	return (len >> 2) - 1;
 }
 
+static inline bool nvme_is_ana_error(u16 status)
+{
+	switch (status & 0x7ff) {
+	case NVME_SC_ANA_TRANSITION:
+	case NVME_SC_ANA_INACCESSIBLE:
+	case NVME_SC_ANA_PERSISTENT_LOSS:
+		return true;
+	default:
+		return false;
+	}
+}
+
+static inline bool nvme_is_path_error(u16 status)
+{
+	switch (status & 0x7ff) {
+	case NVME_SC_HOST_PATH_ERROR:
+	case NVME_SC_HOST_ABORTED_CMD:
+	case NVME_SC_ANA_TRANSITION:
+	case NVME_SC_ANA_INACCESSIBLE:
+	case NVME_SC_ANA_PERSISTENT_LOSS:
+		return true;
+	default:
+		return false;
+	}
+}
+
 /*
  * Fill in the status and result information from the CQE, and then figure
  * out if we blk-mq will need to use IPI magic to complete the request, and
@@ -635,7 +661,7 @@ void nvme_mpath_wait_freeze(struct nvme_subsystem *subsys);
 void nvme_mpath_start_freeze(struct nvme_subsystem *subsys);
 void nvme_set_disk_name(char *disk_name, struct nvme_ns *ns,
 			struct nvme_ctrl *ctrl, int *flags);
-bool nvme_failover_req(struct request *req);
+void nvme_failover_req(struct request *req);
 void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl);
 int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl,struct nvme_ns_head *head);
 void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id);
@@ -694,9 +720,8 @@ static inline void nvme_set_disk_name(char *disk_name, struct nvme_ns *ns,
 	sprintf(disk_name, "nvme%dn%d", ctrl->instance, ns->head->instance);
 }
 
-static inline bool nvme_failover_req(struct request *req)
+static inline void nvme_failover_req(struct request *req)
 {
-	return false;
 }
 static inline void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl)
 {
Signature · 7 lines
2.28.0


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Reviewed-by on v1 2/4
#4 lore raw

Re: [PATCH 2/4] nvme: refactor command completion

Quoted 6 lines · Christoph Hellwig

Lift all the code to decide the dispostition of a completed command from nvme_complete_rq and nvme_failover_req into a new helper, which returns an emum of the potential actions. nvme_complete_rq then just switches on those and calls the proper helper for the action.

Great work, really like this. Think it will help keep NVMe error handling robust and more approachable if some unexplained behaviour occurs in future.

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

#5 lore raw

Re: [PATCH 2/4] nvme: refactor command completion

In reply to Christoph Hellwig
Quoted 48 lines · Christoph Hellwig

Lift all the code to decide the dispostition of a completed command from nvme_complete_rq and nvme_failover_req into a new helper, which returns an emum of the potential actions. nvme_complete_rq then just switches on those and calls the proper helper for the action.

---
 drivers/nvme/host/core.c      | 76 ++++++++++++++++++++++-------------
 drivers/nvme/host/multipath.c | 47 ++++++----------------
 drivers/nvme/host/nvme.h      | 31 ++++++++++++--
 3 files changed, 90 insertions(+), 64 deletions(-)
drivers/nvme/host/core.c +7 -13
index 88cff309d8e4f0..8d474adad721fb 100644
@@ -241,17 +241,6 @@ static blk_status_t nvme_error_status(u16 status)
 	}
 }
 
-static inline bool nvme_req_needs_retry(struct request *req)
-{
-	if (blk_noretry_request(req))
-		return false;
-	if (nvme_req(req)->status & NVME_SC_DNR)
-		return false;
-	if (nvme_req(req)->retries >= nvme_max_retries)
-		return false;
-	return true;
-}
-
 static void nvme_retry_req(struct request *req)
 {
 	struct nvme_ns *ns = req->q->queuedata;
@@ -268,34 +257,67 @@ static void nvme_retry_req(struct request *req)
 	blk_mq_delay_kick_requeue_list(req->q, delay);
 }
 
-void nvme_complete_rq(struct request *req)
+enum nvme_disposition {
+	COMPLETE,
+	RETRY,
+	FAILOVER,
+};
+
+static inline enum nvme_disposition nvme_decide_disposition(struct request *req)
 {
-	blk_status_t status = nvme_error_status(nvme_req(req)->status);

drivers/nvme/host/core.c static void nvme_retry_req(struct request *req) · line 275

Quoted 10 lines
drivers/nvme/host/core.c +6 -2
+	u16 status = nvme_req(req)->status & 0x7ff;
 
-	trace_nvme_complete_rq(req);
+	if (likely(status == 0))
+		return COMPLETE;
 
-	nvme_cleanup_cmd(req);
+	if (blk_noretry_request(req) || (status & NVME_SC_DNR) ||
+	    nvme_req(req)->retries >= nvme_max_retries)
+		return COMPLETE;

Looking just a bit closer, the above DNR test seems wrong because of the 0x7ff mask applied. That mask drops access to NVME_SC_DNR right?

Mike

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

author maintainer
#6 lore raw

Re: [PATCH 2/4] nvme: refactor command completion

Quoted 7 lines · Mike Snitzer
Quoted 7 lines
drivers/nvme/host/core.c +3 -2
-	blk_status_t status = nvme_error_status(nvme_req(req)->status);
+	u16 status = nvme_req(req)->status & 0x7ff;
 
-	trace_nvme_complete_rq(req);
+	if (likely(status == 0))
+		return COMPLETE;
Quoted 7 lines

drivers/nvme/host/core.c static void nvme_retry_req(struct request *req) · line 275

Quoted 4 lines
drivers/nvme/host/core.c +3 -1
-	nvme_cleanup_cmd(req);
+	if (blk_noretry_request(req) || (status & NVME_SC_DNR) ||
+	    nvme_req(req)->retries >= nvme_max_retries)
+		return COMPLETE;

Looking just a bit closer, the above DNR test seems wrong because of the 0x7ff mask applied. That mask drops access to NVME_SC_DNR right?

Indeed. And the whole masking is rather pointless as nvme_is_path_error already performs it as well..

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

author maintainer
#7 lore raw

PATCH 3/4 nvme: just check the status code type in nvme_is_path_error

In reply to Christoph Hellwig

Check the SCT sub-field for a path related status instead of enumerating invididual status code. As of NVMe 1.4 this adds "Internal Path Error" and "Controller Pathing Error" to the list, but it also future proofs for additional status codes added to the category.

---
 drivers/nvme/host/nvme.h | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/nvme/host/nvme.h +1 -10
index dfcdeb318f3ab6..11ee0176fc45f4 100644
@@ -537,16 +537,7 @@ static inline bool nvme_is_ana_error(u16 status)
 
 static inline bool nvme_is_path_error(u16 status)
 {
-	switch (status & 0x7ff) {
-	case NVME_SC_HOST_PATH_ERROR:
-	case NVME_SC_HOST_ABORTED_CMD:
-	case NVME_SC_ANA_TRANSITION:
-	case NVME_SC_ANA_INACCESSIBLE:
-	case NVME_SC_ANA_PERSISTENT_LOSS:
-		return true;
-	default:
-		return false;
-	}
+	return (status & 0x700) == 0x300;
 }
 
 /*
Signature · 7 lines
2.28.0


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Reviewed-by on v1 3/4
#8 lore raw

Re: [PATCH 3/4] nvme: just check the status code type in nvme_is_path_error

Quoted 7 lines · Christoph Hellwig

Check the SCT sub-field for a path related status instead of enumerating invididual status code. As of NVMe 1.4 this adds "Internal Path Error" and "Controller Pathing Error" to the list, but it also future proofs for additional status codes added to the category.

Ah, this is why you carried the duplicate checks in 2/4's nvme_is_path_error and nvme_is_ana_error, makes sense.

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

maintainer
#9 lore raw

Re: [PATCH 3/4] nvme: just check the status code type in nvme_is_path_error

In reply to Christoph Hellwig
Quoted 21 lines

Check the SCT sub-field for a path related status instead of enumerating invididual status code. As of NVMe 1.4 this adds "Internal Path Error" and "Controller Pathing Error" to the list, but it also future proofs for additional status codes added to the category.

---
  drivers/nvme/host/nvme.h | 11 +----------
  1 file changed, 1 insertion(+), 10 deletions(-)
drivers/nvme/host/nvme.h +0 -1
index dfcdeb318f3ab6..11ee0176fc45f4 100644
@@ -537,16 +537,7 @@ static inline bool nvme_is_ana_error(u16 status)
 
  static inline bool nvme_is_path_error(u16 status)
  {
-	switch (status & 0x7ff) {

drivers/nvme/host/nvme.h static inline bool nvme_is_ana_error(u16 status) · line 540

Quoted 10 lines
drivers/nvme/host/nvme.h +1 -9
-	case NVME_SC_HOST_PATH_ERROR:
-	case NVME_SC_HOST_ABORTED_CMD:
-	case NVME_SC_ANA_TRANSITION:
-	case NVME_SC_ANA_INACCESSIBLE:
-	case NVME_SC_ANA_PERSISTENT_LOSS:
-		return true;
-	default:
-		return false;
-	}
+	return (status & 0x700) == 0x300;

Nit - A little comment may help future readers of this.

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

author maintainer
#10 lore raw

Re: [PATCH 3/4] nvme: just check the status code type in nvme_is_path_error

Quoted 3 lines · Sagi Grimberg

drivers/nvme/host/nvme.h static inline bool nvme_is_ana_error(u16 status) · line 540

Quoted 1 line
drivers/nvme/host/nvme.h +1 -0
+	return (status & 0x700) == 0x300;

Nit - A little comment may help future readers of this.

Ok, I've added one.

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

author maintainer
#11 lore raw

PATCH 4/4 nvme: redirect commands on dying queue

In reply to Christoph Hellwig

From: Chao Leng <[email protected]>

If a command send through nvme-multipath failed on a dying queue, resend it on another path.

[hch: rebased on top of the completion refactoring]
---
 drivers/nvme/host/core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/nvme/host/core.c +4 -4
index 8d474adad721fb..271cb9bf29dcd0 100644
@@ -275,13 +275,13 @@ static inline enum nvme_disposition nvme_decide_disposition(struct request *req)
 		return COMPLETE;
 
 	if (req->cmd_flags & REQ_NVME_MPATH) {
-		if (nvme_is_path_error(status))
+		if (nvme_is_path_error(status) || blk_queue_dying(req->q))
 			return FAILOVER;
+	} else {
+		if (blk_queue_dying(req->q))
+			return COMPLETE;
 	}
 
-	if (blk_queue_dying(req->q))
-		return COMPLETE;
-
 	return RETRY;
 }
 
Signature · 7 lines
2.28.0


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Reviewed-by on v1 4/4
#12 lore raw

Re: [PATCH 4/4] nvme: redirect commands on dying queue

Quoted 9 lines · Christoph Hellwig

From: Chao Leng <[email protected]>

If a command send through nvme-multipath failed on a dying queue, resend it on another path.

[hch: rebased on top of the completion refactoring]

Did we ever learn from Chao what the original issue was? Deciding to failover on completion because blk_queue_dying(), without any other insight, is definitely new to me.

But this looks fine, just in general such blk_queue_dying() checks are pretty racey right? Feels like this might paper over something else but without knowing more:

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

author maintainer
#13 lore raw

Re: [PATCH 4/4] nvme: redirect commands on dying queue

Quoted 8 lines · Mike Snitzer
Quoted 5 lines · Christoph Hellwig

From: Chao Leng <[email protected]>

If a command send through nvme-multipath failed on a dying queue, resend it on another path.

Quoted 8 lines
Quoted 4 lines
[hch: rebased on top of the completion refactoring]

Did we ever learn from Chao what the original issue was? Deciding to failover on completion because blk_queue_dying(), without any other insight, is definitely new to me.

Yes. Basically the controller is going away after returning a retryable error.

Quoted 3 lines

But this looks fine, just in general such blk_queue_dying() checks are pretty racey right? Feels like this might paper over something else but without knowing more:

But I guess the race doesn't matter - if we lose it, ->queue_rq will fail and the submission path will pick another path as well.

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

maintainer
#14 lore raw
In reply to Christoph Hellwig
Quoted 11 lines

Hi all,

the first two patches refactor the common nvme completion code to be a little less obsfucated, and the third one is the fix from Chao to redirect to a different path ported on top of these changes, which now make the fix very simple.

Changes since v1:
- add a new patch to handle the path related errors using the SCT class

This looks good to me,

Do you think this is 5.9-rc material? I'm thinking this should go to 5.10...

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

author maintainer
#15 lore raw
Quoted 8 lines · Sagi Grimberg
Quoted 8 lines

Hi all,

the first two patches refactor the common nvme completion code to be a little less obsfucated, and the third one is the fix from Chao to redirect to a different path ported on top of these changes, which now make the fix very simple.

Quoted 8 lines
Quoted 3 lines

Changes since v1:
- add a new patch to handle the path related errors using the SCT class

This looks good to me,

Do you think this is 5.9-rc material? I'm thinking this should go to 5.10...

I think 5.9 should be fine. We're early in the cycle, we've go a fix, and more important the building blocks for the persistent reservation fix, and also a similar one in ->report_zones that I found now.

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme