Skip to contentSkip to conversation

nvme: Return BLK_STS_TARGET if the DNR bit is set

PATCH New Hannes Reinecke 3 participants 7 messages Aug 6, 2019 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme: Return BLK_STS_TARGET if the DNR bit is set

If the DNR bit is set we should not retry the command, even if the standard status evaluation indicates so.

Signed-off-by Hannes Reinecke <hare at suse.com>
---
 drivers/nvme/host/core.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/nvme/host/core.c +7 -0
index cc09b81fc7f4..c3e9254f4757 100644
@@ -279,6 +279,13 @@ void nvme_complete_rq(struct request *req)
 			return;
 		}
 	}
+	/*
+	 * Any pathing error might be retried, but the DNR bit takes
+	 * precedence. So return BLK_STS_TARGET if the DNR bit is set
+	 * to avoid retrying.
+	 */
+	if (blk_path_error(status) && nvme_req(req)->status & NVME_SC_DNR)
+		status = BLK_STS_TARGET;
 	blk_mq_end_request(req, status);
 }
 EXPORT_SYMBOL_GPL(nvme_complete_rq);
Signature · 1 line
2.16.4
#1 lore raw

PATCH 1/1 nvme: Return BLK_STS_TARGET if the DNR bit is set

Quoted 17 lines · Hannes Reinecke

If the DNR bit is set we should not retry the command, even if the standard status evaluation indicates so.

Signed-off-by Hannes Reinecke <hare at suse.com>
---
  drivers/nvme/host/core.c | 7 +++++++
  1 file changed, 7 insertions(+)
drivers/nvme/host/core.c +0 -0
index cc09b81fc7f4..c3e9254f4757 100644
@@ -279,6 +279,13 @@ void nvme_complete_rq(struct request *req)
  			return;
  		}
  	}

drivers/nvme/host/core.c void nvme_complete_rq(struct request *req) · line 291

Quoted 10 lines
drivers/nvme/host/core.c +7 -0
+	/*
+	 * Any pathing error might be retried, but the DNR bit takes
+	 * precedence. So return BLK_STS_TARGET if the DNR bit is set
+	 * to avoid retrying.
+	 */
+	if (blk_path_error(status) && nvme_req(req)->status & NVME_SC_DNR)
+		status = BLK_STS_TARGET;
  	blk_mq_end_request(req, status);
  }
  EXPORT_SYMBOL_GPL(nvme_complete_rq);

- If DNR always takes precedence, is the blk_path_error() check still needed?

- Can/Should this be done in nvme_error_status()?

Ed

#2 lore raw

PATCH 1/1 nvme: Return BLK_STS_TARGET if the DNR bit is set

Quoted 23 lines · Edmund
Quoted 22 lines · Hannes Reinecke

If the DNR bit is set we should not retry the command, even if the standard status evaluation indicates so.

Signed-off-by Hannes Reinecke <hare at suse.com>

---
? drivers/nvme/host/core.c | 7 +++++++
? 1 file changed, 7 insertions(+)

drivers/nvme/host/core.c +6 -0
index cc09b81fc7f4..c3e9254f4757 100644
@@ -279,6 +279,13 @@ void nvme_complete_rq(struct request *req)
 ????????????? return;
 ????????? }
 ????? }
+??? /*
+???? * Any pathing error might be retried, but the DNR bit takes
+???? * precedence. So return BLK_STS_TARGET if the DNR bit is set
+???? * to avoid retrying.
+???? */
+??? if (blk_path_error(status) && nvme_req(req)->status & NVME_SC_DNR)
Quoted 9 lines

drivers/nvme/host/core.c void nvme_complete_rq(struct request *req) · line 291

Quoted 5 lines
drivers/nvme/host/core.c +1 -0
+??????? status = BLK_STS_TARGET;
 ????? blk_mq_end_request(req, status);
 ? }
 ? EXPORT_SYMBOL_GPL(nvme_complete_rq);

- If DNR always takes precedence, is the blk_path_error() check still needed?

It takes precedence in the sense that it should cause the command not to be retried. It should not overwrite any error code indicating a non-retryable error.

Quoted 2 lines

- Can/Should this be done in nvme_error_status()?

Possibly; I don't mind.

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke            Teamlead Storage & Networking
hare at suse.de                              +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: Felix Imend?rffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG N?rnberg)
maintainer
#3 lore raw

PATCH 1/1 nvme: Return BLK_STS_TARGET if the DNR bit is set

Quoted 33 lines · Hannes Reinecke
Quoted 23 lines · Edmund
Quoted 22 lines · Hannes Reinecke

If the DNR bit is set we should not retry the command, even if the standard status evaluation indicates so.

Signed-off-by Hannes Reinecke <hare at suse.com>

---
? drivers/nvme/host/core.c | 7 +++++++
? 1 file changed, 7 insertions(+)

drivers/nvme/host/core.c +6 -0
index cc09b81fc7f4..c3e9254f4757 100644
@@ -279,6 +279,13 @@ void nvme_complete_rq(struct request *req)
 ????????????? return;
 ????????? }
 ????? }
+??? /*
+???? * Any pathing error might be retried, but the DNR bit takes
+???? * precedence. So return BLK_STS_TARGET if the DNR bit is set
+???? * to avoid retrying.
+???? */
+??? if (blk_path_error(status) && nvme_req(req)->status & NVME_SC_DNR)
Quoted 9 lines

drivers/nvme/host/core.c void nvme_complete_rq(struct request *req) · line 291

Quoted 5 lines
drivers/nvme/host/core.c +1 -0
+??????? status = BLK_STS_TARGET;
 ????? blk_mq_end_request(req, status);
 ? }
 ? EXPORT_SYMBOL_GPL(nvme_complete_rq);

- If DNR always takes precedence, is the blk_path_error() check still needed?

Quoted 3 lines

It takes precedence in the sense that it should cause the command not to be retried. It should not overwrite any error code indicating a non-retryable error.

But we're already past the nvme retry logic, which also handles the DNR bit. Who is this telling not to retry?

#4 lore raw

PATCH 1/1 nvme: Return BLK_STS_TARGET if the DNR bit is set

Quoted 34 lines · Keith Busch
Quoted 33 lines · Hannes Reinecke
Quoted 32 lines · Edmund
Quoted 17 lines · Hannes Reinecke

If the DNR bit is set we should not retry the command, even if the standard status evaluation indicates so.

Signed-off-by Hannes Reinecke <hare at suse.com>
---
 ? drivers/nvme/host/core.c | 7 +++++++

? 1 file changed, 7 insertions(+)

drivers/nvme/host/core.c +0 -0
index cc09b81fc7f4..c3e9254f4757 100644
@@ -279,6 +279,13 @@ void nvme_complete_rq(struct request *req)
 ????????????? return;
 ????????? }
 ????? }

drivers/nvme/host/core.c void nvme_complete_rq(struct request *req) · line 291

Quoted 10 lines
drivers/nvme/host/core.c +7 -0
+??? /*
+???? * Any pathing error might be retried, but the DNR bit takes
+???? * precedence. So return BLK_STS_TARGET if the DNR bit is set
+???? * to avoid retrying.
+???? */
+??? if (blk_path_error(status) && nvme_req(req)->status & NVME_SC_DNR)
+??????? status = BLK_STS_TARGET;
 ????? blk_mq_end_request(req, status);
 ? }
 ? EXPORT_SYMBOL_GPL(nvme_complete_rq);

- If DNR always takes precedence, is the blk_path_error() check still needed?

Quoted 7 lines
Quoted 3 lines

It takes precedence in the sense that it should cause the command not to be retried. It should not overwrite any error code indicating a non-retryable error.

But we're already past the nvme retry logic, which also handles the DNR bit. Who is this telling not to retry?

Anything layered on top of it, namely dm-multipath or MD.

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke            Teamlead Storage & Networking
hare at suse.de                              +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: Felix Imend?rffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG N?rnberg)
maintainer
#5 lore raw

PATCH 1/1 nvme: Return BLK_STS_TARGET if the DNR bit is set

Quoted 35 lines · Hannes Reinecke
Quoted 34 lines · Keith Busch
Quoted 33 lines · Hannes Reinecke
Quoted 32 lines · Edmund
Quoted 17 lines · Hannes Reinecke

If the DNR bit is set we should not retry the command, even if the standard status evaluation indicates so.

Signed-off-by Hannes Reinecke <hare at suse.com>
---
 ? drivers/nvme/host/core.c | 7 +++++++

? 1 file changed, 7 insertions(+)

drivers/nvme/host/core.c +0 -0
index cc09b81fc7f4..c3e9254f4757 100644
@@ -279,6 +279,13 @@ void nvme_complete_rq(struct request *req)
 ????????????? return;
 ????????? }
 ????? }

drivers/nvme/host/core.c void nvme_complete_rq(struct request *req) · line 291

Quoted 10 lines
drivers/nvme/host/core.c +7 -0
+??? /*
+???? * Any pathing error might be retried, but the DNR bit takes
+???? * precedence. So return BLK_STS_TARGET if the DNR bit is set
+???? * to avoid retrying.
+???? */
+??? if (blk_path_error(status) && nvme_req(req)->status & NVME_SC_DNR)
+??????? status = BLK_STS_TARGET;
 ????? blk_mq_end_request(req, status);
 ? }
 ? EXPORT_SYMBOL_GPL(nvme_complete_rq);

- If DNR always takes precedence, is the blk_path_error() check still needed?

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

It takes precedence in the sense that it should cause the command not to be retried. It should not overwrite any error code indicating a non-retryable error.

But we're already past the nvme retry logic, which also handles the DNR bit. Who is this telling not to retry?

Anything layered on top of it, namely dm-multipath or MD.

Okay, that's what I thought. Can we just move this check to fit in the unlikely() error case just above where you have it?

#6 lore raw

PATCH 1/1 nvme: Return BLK_STS_TARGET if the DNR bit is set

Quoted 40 lines · Keith Busch
Quoted 39 lines · Hannes Reinecke
Quoted 38 lines · Keith Busch
Quoted 36 lines · Hannes Reinecke
Quoted 23 lines · Edmund
Quoted 22 lines · Hannes Reinecke

If the DNR bit is set we should not retry the command, even if the standard status evaluation indicates so.

Signed-off-by Hannes Reinecke <hare at suse.com>
---
  ? drivers/nvme/host/core.c | 7 +++++++

? 1 file changed, 7 insertions(+)

drivers/nvme/host/core.c +6 -0
index cc09b81fc7f4..c3e9254f4757 100644
@@ -279,6 +279,13 @@ void nvme_complete_rq(struct request *req)
  ????????????? return;
  ????????? }
  ????? }
+??? /*
+???? * Any pathing error might be retried, but the DNR bit takes
+???? * precedence. So return BLK_STS_TARGET if the DNR bit is set
+???? * to avoid retrying.
+???? */
+??? if (blk_path_error(status) && nvme_req(req)->status & NVME_SC_DNR)
Quoted 9 lines

drivers/nvme/host/core.c void nvme_complete_rq(struct request *req) · line 291

Quoted 5 lines
drivers/nvme/host/core.c +1 -0
+??????? status = BLK_STS_TARGET;
  ????? blk_mq_end_request(req, status);
  ? }
  ? EXPORT_SYMBOL_GPL(nvme_complete_rq);

- If DNR always takes precedence, is the blk_path_error() check still needed?

It takes precedence in the sense that it should cause the command not to be retried. It should not overwrite any error code indicating a non-retryable error.

Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

But we're already past the nvme retry logic, which also handles the DNR bit. Who is this telling not to retry?

Anything layered on top of it, namely dm-multipath or MD.

Okay, that's what I thought. Can we just move this check to fit in the unlikely() error case just above where you have it?

Why, sure, of course.
Will be sending an updated patch.

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke            Teamlead Storage & Networking
hare at suse.de                              +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: Felix Imend?rffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG N?rnberg)