Skip to contentSkip to conversation

Improve response status code of nvme target

PATCH Superseded Hou Pu 2 participants 9 messages Mar 30, 2021 – Mar 31, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Hou Pu

author
#0 lore raw

cover Improve response status code of nvme target

This series includes some improvement of response status code.

Hou Pu (2):
nvmet: return proper error code from discovery ctrl
nvmet: remove unneeded code from nvmet_alloc_ctrl()

 drivers/nvme/target/core.c      | 1 -
 drivers/nvme/target/discovery.c | 6 ++++--
 2 files changed, 4 insertions(+), 3 deletions(-)
Signature · 7 lines
2.28.0


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
author
#1 lore raw

PATCH 1/2 nvmet: return proper error code from discovery ctrl

Return NVME_SC_INVALID_FIELD from discovery controller like normal controller when executing identify or get log page command.

---
 drivers/nvme/target/discovery.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/nvme/target/discovery.c +4 -2
index 682854e0e079..4845d12e374a 100644
@@ -178,12 +178,14 @@ static void nvmet_execute_disc_get_log_page(struct nvmet_req *req)
 	if (req->cmd->get_log_page.lid != NVME_LOG_DISC) {
 		req->error_loc =
 			offsetof(struct nvme_get_log_page_command, lid);
-		status = NVME_SC_INVALID_OPCODE | NVME_SC_DNR;
+		status = NVME_SC_INVALID_FIELD | NVME_SC_DNR;
 		goto out;
 	}
 
 	/* Spec requires dword aligned offsets */
 	if (offset & 0x3) {
+		req->error_loc =
+			offsetof(struct nvme_get_log_page_command, lpo);
 		status = NVME_SC_INVALID_FIELD | NVME_SC_DNR;
 		goto out;
 	}
@@ -250,7 +252,7 @@ static void nvmet_execute_disc_identify(struct nvmet_req *req)
 
 	if (req->cmd->identify.cns != NVME_ID_CNS_CTRL) {
 		req->error_loc = offsetof(struct nvme_identify, cns);
-		status = NVME_SC_INVALID_OPCODE | NVME_SC_DNR;
+		status = NVME_SC_INVALID_FIELD | NVME_SC_DNR;
 		goto out;
 	}
 
Signature · 7 lines
2.28.0


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] nvmet: return proper error code from discovery ctrl

Quoted 5 lines · Hou Pu

Return NVME_SC_INVALID_FIELD from discovery controller like normal controller when executing identify or get log page command.

Commit could be :-

Return NVME_SC_INVALID_FIELD from discovery controller like normal controller when executing identify or get log page command.

Can be done at the time of applying the patch.

With that looks good.

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

author
#3 lore raw

Re: [PATCH 1/2] nvmet: return proper error code from discovery ctrl

Quoted 8 lines · Chaitanya Kulkarni
Quoted 5 lines · Hou Pu

Return NVME_SC_INVALID_FIELD from discovery controller like normal controller when executing identify or get log page command.

Commit could be :-

Quoted 9 lines

Return NVME_SC_INVALID_FIELD from discovery controller like normal controller when executing identify or get log page command.

Can be done at the time of applying the patch.

With that looks good.

Thanks,

Hou

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

author
#4 lore raw

PATCH 2/2 nvmet: remove unneeded code from nvmet_alloc_ctrl()

In reply to Hou Pu
---
 drivers/nvme/target/core.c | 1 -
 1 file changed, 1 deletion(-)
drivers/nvme/target/core.c +0 -1
index a027433b8be8..1c2130b344f2 100644
@@ -1325,7 +1325,6 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
 		goto out;
 	}
 
-	status = NVME_SC_CONNECT_INVALID_PARAM | NVME_SC_DNR;
 	down_read(&nvmet_config_sem);
 	if (!nvmet_host_allowed(subsys, hostnqn)) {
 		pr_info("connect by host %s for subsystem %s not allowed\n",
Signature · 7 lines
2.28.0


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
author
#6 lore raw

Re: [PATCH 2/2] nvmet: remove unneeded code from nvmet_alloc_ctrl()

Quoted 8 lines · Chaitanya Kulkarni
Quoted 4 lines · Hou Pu
---
  drivers/nvme/target/core.c | 1 -
  1 file changed, 1 deletion(-)

On what branch you have generated this patch ?

The patch is based on v5.12-rc4.

(https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/nvme/target/core.c?h=v5.12-rc4#n1328)

Thanks,

Hou

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

#7 lore raw

Re: [PATCH 2/2] nvmet: remove unneeded code from nvmet_alloc_ctrl()

On 3/30/21, 7:18 PM, "Hou Pu" <[email protected]> wrote:

    On 2021/3/31 7:30 上午, Chaitanya Kulkarni wrote:
    > On 3/30/21 04:59, Hou Pu wrote:
    >> Signed-off-by: Hou Pu <[email protected]>
    >> ---
    >>   drivers/nvme/target/core.c | 1 -
    >>   1 file changed, 1 deletion(-)
    > On what branch you have generated this patch ?
    >
    >
    The patch is based on v5.12-rc4.

    (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/nvme/target/core.c?h=v5.12-rc4#n1328)


    Thanks,

    Hou

I think I've fixed this in 5.13, please check, if so we may need to drop this patch.

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

author
#8 lore raw

Re: [PATCH 2/2] nvmet: remove unneeded code from nvmet_alloc_ctrl()

Quoted 23 lines · Chaitanya Kulkarni

On 3/30/21, 7:18 PM, "Hou Pu" <[email protected]> wrote:

     On 2021/3/31 7:30 上午, Chaitanya Kulkarni wrote:
     > On 3/30/21 04:59, Hou Pu wrote:
     >> Signed-off-by: Hou Pu <[email protected]>
     >> ---
     >>   drivers/nvme/target/core.c | 1 -
     >>   1 file changed, 1 deletion(-)
     > On what branch you have generated this patch ?
     >
     >
     The patch is based on v5.12-rc4.

     (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/nvme/target/core.c?h=v5.12-rc4#n1328)


     Thanks,

     Hou
Quoted 1 line

I think I've fixed this in 5.13, please check, if so we may need to drop this patch.

Yes, just notice that from nvme.git tree. Thanks.

I will drop this in v2.

Thanks,

Hou

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme