Re: [PATCH 5/6] nvme: return NVME_SC_ABORT_QUEUE for cancelled commands
From: Keith Busch <kbusch@kernel.org>
Date: 2021-02-25 16:43:26
On Thu, Feb 25, 2021 at 11:55:26AM +0100, Hannes Reinecke wrote:
A request will be cancelled when a queue is deleted, so we should be returning a status of NVME_SC_ABORT_QUEUE.
I'm not sure if this makes sense. The controller didn't return a status in this case, so the host is reclaiming the command absent a status from the controller. Is there a particular situation where this patch matters?
quoted hunk ↗ jump to hunk
Signed-off-by: Hannes Reinecke <hare@suse.de> --- drivers/nvme/host/core.c | 2 +- drivers/nvme/host/fc.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-)diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 04dc85e0810c..624531a6b7c6 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c@@ -379,7 +379,7 @@ bool nvme_cancel_request(struct request *req, void *data, bool reserved) if (blk_mq_request_completed(req)) return true; - nvme_req(req)->status = NVME_SC_HOST_ABORTED_CMD; + nvme_req(req)->status = NVME_SC_ABORT_QUEUE; nvme_req(req)->flags |= NVME_REQ_CANCELLED; blk_mq_complete_request(req); return true;diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index 97e3424c7b03..86395b66310d 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c@@ -1955,9 +1955,12 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) fc_dma_sync_single_for_cpu(ctrl->lport->dev, op->fcp_req.rspdma, sizeof(op->rsp_iu), DMA_FROM_DEVICE); - if (opstate == FCPOP_STATE_ABORTED) - status = cpu_to_le16(NVME_SC_HOST_ABORTED_CMD << 1); - else if (freq->status) { + if (opstate == FCPOP_STATE_ABORTED) { + if (op->nreq.flags & NVME_REQ_CANCELLED) + status = cpu_to_le16(NVME_SC_ABORT_QUEUE << 1); + else + status = cpu_to_le16(NVME_SC_HOST_ABORTED_CMD << 1); + } else if (freq->status) { status = cpu_to_le16(NVME_SC_HOST_PATH_ERROR << 1); dev_info(ctrl->ctrl.device, "NVME-FC{%d}: io failed due to lldd error %d\n",-- 2.29.2
_______________________________________________ Linux-nvme mailing list Linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme