Blob Blame History Raw
From: Guan Junxiong <guanjunxiong@huawei.com>
Date: Fri, 4 Aug 2017 17:27:47 +0800
Subject: nvmet: fix the return error code of target if host is not allowed
Patch-mainline: v4.14-rc1
Git-commit: 130c24b5be80512be973e3a614abda75f5896b42
References: FATE#323952, FATE#322506

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>
Acked-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 drivers/nvme/target/core.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -749,6 +749,7 @@ u16 nvmet_alloc_ctrl(const char *subsysn
 			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);