nvme: Return BLK_STS_TARGET if the DNR bit is set
PATCH v2 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 | 4 ++++ 1 file changed, 4 insertions(+)
drivers/nvme/host/core.c +4 -0
@@ -274,6 +274,10 @@ void nvme_complete_rq(struct request *req)return ; } +if (nvme_req (req)->status &NVME_SC_DNR ) { +blk_mq_end_request (req,BLK_STS_TARGET ); +return ; + }if (!blk_queue_dying (req->q)) {nvme_retry_req (req);return ;
Signature · 1 line
2.16.4
Keith Busch
maintainerPATCH v2 1/1 nvme: Return BLK_STS_TARGET if the DNR bit is set
Quoted 14 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 | 4 ++++ 1 file changed, 4 insertions(+)drivers/nvme/host/core.c +0
-0
drivers/nvme/host/core.c void nvme_complete_rq(struct request *req) · line 283
Quoted 10 lines
drivers/nvme/host/core.c +4
-0@@ -274,6 +274,10 @@ void nvme_complete_rq(struct request *req)return ; } +if (nvme_req (req)->status &NVME_SC_DNR ) { +blk_mq_end_request (req,BLK_STS_TARGET ); +return ; + }if (!blk_queue_dying (req->q)) {nvme_retry_req (req);return ;
Ah, that's unreachable code since it wouldn't get past the nvme_req_needs_retry() check for this branch. We'd need to reshuffle this a bit, but at least it gets all the error handling in a single case. Something like this:
---
drivers/nvme/host/core.c +15 -9
@@ -267,17 +267,23 @@ 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); +return ; + } } + +if (blk_path_error (status) && +nvme_req (req)->status &NVME_SC_DNR ) + status =BLK_STS_TARGET ; }blk_mq_end_request (req, status); }
--