nvme: fix cntlid uniqueness check for different hosts
Sagi Grimberg
maintainerPATCH 1/1 nvme: fix cntlid uniqueness check for different hosts
A single physical host may use a separate {hostnqn, hostid} identifiers when connecting to a controller. It is possible that the a distributed nvmf controller may generate unique cntlid per hostnqn and not globally unique. Hence, validate the cntlid is unique per nvmf host.
--- drivers/nvme/host/core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/nvme/host/core.c +4 -0
@@ -3265,6 +3265,10 @@ static bool nvme_validate_cntlid(struct nvme_subsystem *subsys,if (nvme_state_terminal (tmp))continue ; +if ((ctrl->ops->flags &NVME_F_FABRICS ) && + !nvmf_ctlr_matches_baseopts (tmp, ctrl->opts)) +continue ; +if (tmp->cntlid == ctrl->cntlid) { dev_err(ctrl->device, "Duplicate cntlid %u with %s, subsys %s, rejecting\n",
Signature · 1 line
2.43.0
Sagi Grimberg
maintainerQuoted 7 lines · Sagi Grimberg
A single physical host may use a separate {hostnqn, hostid} identifiers when connecting to a controller. It is possible that the a distributed nvmf controller may generate unique cntlid per hostnqn and not globally unique. Hence, validate the cntlid is unique per nvmf host.
Fixes 1b1031ca63b2 ("nvme: validate cntlid during controller initialisation")Signed-off-by Sagi Grimberg <[email protected]>
Any thoughts on this one?
Christoph Hellwig
maintainerQuoted 2 lines · Sagi Grimberg
A single physical host may use a separate {hostnqn, hostid} identifiers when connecting to a controller.
Not really. As the hostid defines a host. Linux just might be able to implement multiple hosts when it say hosts multiple containers.
Quoted 3 lines
It is possible that the a distributed
nvmf controller may generate unique cntlid per hostnqn and not globally unique. Hence, validate the cntlid is unique per nvmf host.
If it does so it is not spec compliant, and we should not support it.
Sagi Grimberg
maintainerQuoted 5 lines · Christoph Hellwig
Quoted 2 lines · Sagi Grimberg
A single physical host may use a separate {hostnqn, hostid} identifiers when connecting to a controller.
Not really. As the hostid defines a host. Linux just might be able to implement multiple hosts when it say hosts multiple containers.
Well, from the subsystem perspective, it is a separate host.
Quoted 5 lines
Quoted 4 lines
It is possible that the a distributed
nvmf controller may generate unique cntlid per hostnqn and not globally unique. Hence, validate the cntlid is unique per nvmf host.If it does so it is not spec compliant, and we should not support it.
Hmm, interesting. It didn't occur to me that the cross-hosts controller IDs are meaningful in any way.. The issue is that if a host connects to multiple subsystem ports (say 16 for multipath), and also may use multiple hostnqn/hostid pairs, the available number of cntlids starts dropping very quickly given that there are only 16 bits in cntlid.
I am wandering if this issue was observed by others.