linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvmet: do not ignore error_location FFFFh (NVMET_NO_ERROR_LOC) on nvmet_set_error
@ 2021-04-11  8:18 amit.engel
  2021-04-11 22:05 ` Chaitanya Kulkarni
  0 siblings, 1 reply; 2+ messages in thread
From: amit.engel @ 2021-04-11  8:18 UTC (permalink / raw)
  To: linux-nvme; +Cc: amit.engel

From: Amit Engel <amit.engel@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@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


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] nvmet: do not ignore error_location FFFFh (NVMET_NO_ERROR_LOC) on nvmet_set_error
  2021-04-11  8:18 [PATCH] nvmet: do not ignore error_location FFFFh (NVMET_NO_ERROR_LOC) on nvmet_set_error amit.engel
@ 2021-04-11 22:05 ` Chaitanya Kulkarni
  0 siblings, 0 replies; 2+ messages in thread
From: Chaitanya Kulkarni @ 2021-04-11 22:05 UTC (permalink / raw)
  To: amit.engel, linux-nvme

On 4/11/21 01:29, amit.engel@dell.com wrote:
> 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;
>  }
>  

Do you have an application level use case to recording the internal errors
for target ?



_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-11 22:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-11  8:18 [PATCH] nvmet: do not ignore error_location FFFFh (NVMET_NO_ERROR_LOC) on nvmet_set_error amit.engel
2021-04-11 22:05 ` Chaitanya Kulkarni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).