nvme-fabrics: prevent overriding of existing host
authorMax Gurtovoy <mgurtovoy@nvidia.com>
Fri, 12 May 2023 15:41:55 +0000 (18:41 +0300)
committerKeith Busch <kbusch@kernel.org>
Mon, 12 Jun 2023 17:36:58 +0000 (10:36 -0700)
commitae8bd606e09bbdb2607c8249872cc2aeaf2fcc72
treebc1c1c52d3e0732bdef4f1ea1261ac954187fb6f
parent5e4b55fa522ec0839f33a73fe5facf609ee66b58
nvme-fabrics: prevent overriding of existing host

When first connecting a target using the "default" host parameters,
setting the hostid from the command line during a subsequent connection
establishment would override the "default" hostid parameter. This would
cause an existing connection that is already using the host definitions
to lose its hostid.

To address this issue, the code has been modified to allow only 1:1
mapping between hostnqn and hostid. This will maintain unambiguous host
identification. Any non 1:1 mapping will be rejected during connection
establishment.

Tested-by: Noam Gottlieb <ngottlieb@nvidia.com>
Reviewed-by: Israel Rukshin <israelr@nvidia.com>
Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/host/fabrics.c