linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [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

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).