nvmet: fix the return error code of target if host is not allowed
authorGuan Junxiong <guanjunxiong@huawei.com>
Fri, 4 Aug 2017 09:27:47 +0000 (17:27 +0800)
committerChristoph Hellwig <hch@lst.de>
Mon, 28 Aug 2017 19:38:20 +0000 (21:38 +0200)
nvmf target shall return NVME_SC_CONNECT_INVALID_HOST instead of
the gereal code INVALID_PARAM when the given host nqn is not allowed
to connect. Refer to the 2.2.1 section of the NVMe over Fabrics Spec.

Signed-off-by: Guan Junxiong <guanjunxiong@huawei.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/core.c

index f4b02bb4a1a891c578bb8cae3ad7a8db7ef5cc1d..ea7eb00dcb87c0517e3700c76e11b08451edf43d 100644 (file)
@@ -749,6 +749,7 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
                        hostnqn, subsysnqn);
                req->rsp->result.u32 = IPO_IATTR_CONNECT_DATA(hostnqn);
                up_read(&nvmet_config_sem);
+               status = NVME_SC_CONNECT_INVALID_HOST | NVME_SC_DNR;
                goto out_put_subsystem;
        }
        up_read(&nvmet_config_sem);