linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv3] nvme: Return BLK_STS_TARGET if the DNR bit is set
@ 2019-08-12  7:51 Hannes Reinecke
  2019-08-12 23:37 ` Nadolski, Edmund
  2019-08-13 17:01 ` Christoph Hellwig
  0 siblings, 2 replies; 9+ messages in thread
From: Hannes Reinecke @ 2019-08-12  7:51 UTC (permalink / raw)


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 | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index cc09b81fc7f4..5e1309709917 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -267,15 +267,20 @@ void nvme_complete_rq(struct request *req)
 	if (nvme_req(req)->ctrl->kas)
 		nvme_req(req)->ctrl->comp_seen = true;
 
-	if (unlikely(status != BLK_STS_OK && nvme_req_needs_retry(req))) {
-		if ((req->cmd_flags & REQ_NVME_MPATH) &&
-		    blk_path_error(status)) {
-			nvme_failover_req(req);
-			return;
+	if (unlikely(status != BLK_STS_OK)) {
+		if (nvme_req_needs_retry(req)) {
+			if ((req->cmd_flags & REQ_NVME_MPATH) &&
+			    blk_path_error(status)) {
+				nvme_failover_req(req);
+				return;
+			}
+			if (!blk_queue_dying(req->q)) {
+				nvme_retry_req(req);
+				return;
+			}
 		}
-
-		if (!blk_queue_dying(req->q)) {
-			nvme_retry_req(req);
+		if (nvme_req(req)->status & NVME_SC_DNR) {
+			blk_mq_end_request(req, BLK_STS_TARGET);
 			return;
 		}
 	}
-- 
2.16.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-08-13 17:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-12  7:51 [PATCHv3] nvme: Return BLK_STS_TARGET if the DNR bit is set Hannes Reinecke
2019-08-12 23:37 ` Nadolski, Edmund
2019-08-13  6:32   ` Sagi Grimberg
2019-08-13 14:15     ` Keith Busch
2019-08-13 16:37       ` Sagi Grimberg
2019-08-13 16:56         ` Hannes Reinecke
2019-08-13 17:01 ` Christoph Hellwig
2019-08-13 17:03   ` Hannes Reinecke
2019-08-13 17:08     ` Christoph Hellwig

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).