[PATCH] nvmet: do not ignore error_location FFFFh (NVMET_NO_ERROR_LOC) on nvmet_set_error
amit.engel at dell.com
amit.engel at dell.com
Sun Apr 11 09:18:31 BST 2021
From: Amit Engel <amit.engel at dell.com>
by nvme spec, get log page error information (lid 01h):
'parameter error location' field shall be set to FFFFh
"if the error is not specific to a particular command"
in addition, add missing error_loc in some flows
Signed-off-by: Amit Engel <amit.engel at dell.com>
---
drivers/nvme/target/admin-cmd.c | 6 +++++-
drivers/nvme/target/core.c | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index f4cc32674edd..2506f8de2e8b 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -689,8 +689,10 @@ static u16 nvmet_write_protect_flush_sync(struct nvmet_req *req)
else
status = nvmet_bdev_flush(req);
- if (status)
+ if (status) {
pr_err("write protect flush failed nsid: %u\n", req->ns->nsid);
+ req->error_loc = offsetof(struct nvme_common_command, cdw11);
+ }
return status;
}
@@ -772,6 +774,7 @@ void nvmet_execute_set_features(struct nvmet_req *req)
nsqr = cdw11 & 0xffff;
if (ncqr == 0xffff || nsqr == 0xffff) {
status = NVME_SC_INVALID_FIELD | NVME_SC_DNR;
+ req->error_loc = offsetof(struct nvme_common_command, cdw11);
break;
}
nvmet_set_result(req,
@@ -785,6 +788,7 @@ void nvmet_execute_set_features(struct nvmet_req *req)
break;
case NVME_FEAT_HOST_ID:
status = NVME_SC_CMD_SEQ_ERROR | NVME_SC_DNR;
+ req->error_loc = offsetof(struct nvme_common_command, cdw10);
break;
case NVME_FEAT_WRITE_PROTECT:
status = nvmet_set_feat_write_protect(req);
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index adbede9ab7f3..23874276a2aa 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -719,7 +719,7 @@ static void nvmet_set_error(struct nvmet_req *req, u16 status)
req->cqe->status = cpu_to_le16(status << 1);
- if (!ctrl || req->error_loc == NVMET_NO_ERROR_LOC)
+ if (!ctrl)
return;
spin_lock_irqsave(&ctrl->error_lock, flags);
--
2.18.2
More information about the Linux-nvme
mailing list