nvmet: do not ignore error_location FFFFh (NVMET_NO_ERROR_LOC) on nvmet_set_error
Subsystems (2)
PATCH 1/1 nvmet: do not ignore error_location FFFFh (NVMET_NO_ERROR_LOC) on nvmet_set_error
From: Amit Engel <[email protected]>
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 <[email protected]>
--- drivers/nvme/target/admin-cmd.c | 6 +++++- drivers/nvme/target/core.c | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/nvme/target/admin-cmd.c +5 -1
@@ -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);
drivers/nvme/target/core.c +1 -1
@@ -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);
Signature · 7 lines
2.18.2 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Quoted 6 lines · On 4/11/21 01:29, [email protected] wrote:
drivers/nvme/target/admin-cmd.c +0
-0@@ -689,8 +689,10 @@ static u16 nvmet_write_protect_flush_sync(struct nvmet_req *req)else
drivers/nvme/target/admin-cmd.c static u16 nvmet_write_protect_flush_sync(struct nvmet_req *req) · line 698
Quoted 10 lines
drivers/nvme/target/admin-cmd.c +3
-1status =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; }
Do you have an application level use case to recording the internal errors for target ?
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme