From: Hannes Reinecke <hare@suse.de>
Date: Tue, 6 Aug 2019 12:47:17 +0200
Subject: [PATCH] nvme: Return BLK_STS_TARGET if the DNR bit is set
References: bsc#1142076
Patch-Mainline: never, solved differently upstream
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@suse.com>
---
drivers/nvme/host/core.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 6afc37292f28..6faa3a99253a 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -265,6 +265,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);
--
2.16.4