* [PATCH] nvme: fix cntlid uniqueness check for different hosts
@ 2026-08-23 0:15 Sagi Grimberg
2026-08-30 22:33 ` Sagi Grimberg
2026-09-02 13:47 ` Christoph Hellwig
0 siblings, 2 replies; 4+ messages in thread
From: Sagi Grimberg @ 2026-08-23 0:15 UTC (permalink / raw)
To: linux-nvme, Christoph Hellwig, Keith Busch
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 <sagi@grimberg.me>
---
drivers/nvme/host/core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 11c24f89f4fd..86c59144da74 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -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",
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] nvme: fix cntlid uniqueness check for different hosts
2026-08-23 0:15 [PATCH] nvme: fix cntlid uniqueness check for different hosts Sagi Grimberg
@ 2026-08-30 22:33 ` Sagi Grimberg
2026-09-02 13:47 ` Christoph Hellwig
1 sibling, 0 replies; 4+ messages in thread
From: Sagi Grimberg @ 2026-08-30 22:33 UTC (permalink / raw)
To: linux-nvme, Christoph Hellwig, Keith Busch
On 23/08/2026 3:15, Sagi Grimberg wrote:
> 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 <sagi@grimberg.me>
Any thoughts on this one?
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] nvme: fix cntlid uniqueness check for different hosts
2026-08-23 0:15 [PATCH] nvme: fix cntlid uniqueness check for different hosts Sagi Grimberg
2026-08-30 22:33 ` Sagi Grimberg
@ 2026-09-02 13:47 ` Christoph Hellwig
2026-09-11 22:45 ` Sagi Grimberg
1 sibling, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2026-09-02 13:47 UTC (permalink / raw)
To: Sagi Grimberg; +Cc: linux-nvme, Christoph Hellwig, Keith Busch
On Sun, Aug 23, 2026 at 03:15:09AM +0300, Sagi Grimberg wrote:
> 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.
> 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.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] nvme: fix cntlid uniqueness check for different hosts
2026-09-02 13:47 ` Christoph Hellwig
@ 2026-09-11 22:45 ` Sagi Grimberg
0 siblings, 0 replies; 4+ messages in thread
From: Sagi Grimberg @ 2026-09-11 22:45 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-nvme, Keith Busch
On 02/09/2026 16:47, Christoph Hellwig wrote:
> On Sun, Aug 23, 2026 at 03:15:09AM +0300, Sagi Grimberg wrote:
>> 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.
>
>> 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.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-11 22:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-23 0:15 [PATCH] nvme: fix cntlid uniqueness check for different hosts Sagi Grimberg
2026-08-30 22:33 ` Sagi Grimberg
2026-09-02 13:47 ` Christoph Hellwig
2026-09-11 22:45 ` Sagi Grimberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).