nvme: move the dying queue check from cancel to completion

With multipath we don't want a hard DNR bit on a request that is cancelled
by a controller reset, but instead want to be able to retry it on another
patch.  To archive this don't always set the DNR bit when the queue is
dying in nvme_cancel_request, but defer that decision to
nvme_req_needs_retry.  Note that it applies to any command there and not
just cancelled commands, but one the queue is dying that is the right
thing to do anyway.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Christoph Hellwig 2017-11-02 21:28:51 +03:00 committed by Jens Axboe
parent a6da0024ff
commit e54b064cb2
1 changed files with 3 additions and 6 deletions

View File

@ -172,6 +172,8 @@ static inline bool nvme_req_needs_retry(struct request *req)
return false; return false;
if (nvme_req(req)->retries >= nvme_max_retries) if (nvme_req(req)->retries >= nvme_max_retries)
return false; return false;
if (blk_queue_dying(req->q))
return false;
return true; return true;
} }
@ -189,18 +191,13 @@ EXPORT_SYMBOL_GPL(nvme_complete_rq);
void nvme_cancel_request(struct request *req, void *data, bool reserved) void nvme_cancel_request(struct request *req, void *data, bool reserved)
{ {
int status;
if (!blk_mq_request_started(req)) if (!blk_mq_request_started(req))
return; return;
dev_dbg_ratelimited(((struct nvme_ctrl *) data)->device, dev_dbg_ratelimited(((struct nvme_ctrl *) data)->device,
"Cancelling I/O %d", req->tag); "Cancelling I/O %d", req->tag);
status = NVME_SC_ABORT_REQ; nvme_req(req)->status = NVME_SC_ABORT_REQ;
if (blk_queue_dying(req->q))
status |= NVME_SC_DNR;
nvme_req(req)->status = status;
blk_mq_complete_request(req); blk_mq_complete_request(req);
} }