OSDN Git Service

nvmet: update error log page in nvmet_alloc_ctrl()
authorChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Thu, 25 Feb 2021 01:56:38 +0000 (17:56 -0800)
committerChristoph Hellwig <hch@lst.de>
Fri, 2 Apr 2021 16:48:25 +0000 (18:48 +0200)
Instead of updating the error log page in the caller of the
nvmet_alloc_ctrt() update the error log page in the nvmet_alloc_ctrl().

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/core.c
drivers/nvme/target/fabrics-cmd.c

index e3b8ec5..c4238c0 100644 (file)
@@ -1311,6 +1311,7 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
                pr_warn("connect request for invalid subsystem %s!\n",
                        subsysnqn);
                req->cqe->result.u32 = IPO_IATTR_CONNECT_DATA(subsysnqn);
+               req->error_loc = offsetof(struct nvme_common_command, dptr);
                goto out;
        }
 
@@ -1321,6 +1322,7 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
                req->cqe->result.u32 = IPO_IATTR_CONNECT_DATA(hostnqn);
                up_read(&nvmet_config_sem);
                status = NVME_SC_CONNECT_INVALID_HOST | NVME_SC_DNR;
+               req->error_loc = offsetof(struct nvme_common_command, dptr);
                goto out_put_subsystem;
        }
        up_read(&nvmet_config_sem);
index 42bd12b..d2289aa 100644 (file)
@@ -190,12 +190,8 @@ static void nvmet_execute_admin_connect(struct nvmet_req *req)
 
        status = nvmet_alloc_ctrl(d->subsysnqn, d->hostnqn, req,
                                  le32_to_cpu(c->kato), &ctrl);
-       if (status) {
-               if (status == (NVME_SC_INVALID_FIELD | NVME_SC_DNR))
-                       req->error_loc =
-                               offsetof(struct nvme_common_command, opcode);
+       if (status)
                goto out;
-       }
 
        ctrl->pi_support = ctrl->port->pi_enable && ctrl->subsys->pi_support;