[PATCH 2/4] nvme: add NVME_REQ_CANCELLED flag in nvme_cancel_request()

Hannes Reinecke hare at suse.de
Fri Feb 26 02:17:26 EST 2021


NVME_REQ_CANCELLED is translated into -EINTR in nvme_submit_sync_cmd(),
so we should be setting this flags during nvme_cancel_request() to
ensure that the callers to nvme_submit_sync_cmd() will get the correct
error code when the controller is reset.

Signed-off-by: Hannes Reinecke <hare at suse.de>
Reviewed-by: Daniel Wagner <dwagner at suse.de>
Reviewed-by: Keith Busch <kbusch at kernel.org>
Reviewed-by: Chao Leng <lengchao at huawei.com>
---
 drivers/nvme/host/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index bde1b22ca7f2..bf32460c180a 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -380,6 +380,7 @@ bool nvme_cancel_request(struct request *req, void *data, bool reserved)
 		return true;
 
 	nvme_req(req)->status = NVME_SC_HOST_ABORTED_CMD;
+	nvme_req(req)->flags |= NVME_REQ_CANCELLED;
 	blk_mq_complete_request(req);
 	return true;
 }
-- 
2.29.2




More information about the Linux-nvme mailing list