[PATCH 2/2] nvme: Add warning when a partiually unique NID is detected

hare at kernel.org hare at kernel.org
Mon Apr 14 02:09:59 PDT 2025


From: Hannes Reinecke <hare at kernel.org>

Some devices have a firmware issue where non-unique value are presented
in some of the NID values. To avoid a failure during booting on these
devices after updating past e2724cb9f0c4 ("nvme: fix the check for duplicate
unique identifiers") issue a warning if these devices are encountered and
set the 'partial_nid' quirk automatically.

Fixes: e2724cb9f0c4 ("nvme: fix the check for duplicate unique identifiers")

Signed-off-by: Hannes Reinecke <hare at kernel.org>
---
 drivers/nvme/host/core.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 9e6f4037f33f..aa554e89c21f 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3764,8 +3764,16 @@ static int nvme_init_ns_head(struct nvme_ns *ns, struct nvme_ns_info *info)
 	int ret;
 
 	ret = nvme_global_check_duplicate_ids(ctrl->subsys, &info->ids);
-	if (ret == -ENOTUNIQ && ctrl->quirks & NVME_QUIRK_PARTIAL_NID)
-		ret = 0;
+	if (ret == -ENOTUNIQ) {
+		if (!(ctrl->quirks & NVME_QUIRK_PARTIAL_NID)) {
+			dev_warn(ctrl->device,
+				 "Non-unique NID detected, add QUIRK_PARTIAL_NID for '%04x' to avoid this warning\n",
+				 ctrl->subsys->vendor_id);
+			ctrl->quirks |= NVME_QUIRK_PARTIAL_NID;
+		}
+		if (ctrl->quirks & NVME_QUIRK_PARTIAL_NID)
+			ret = 0;
+	}
 	if (ret) {
 		/*
 		 * We've found two different namespaces on two different
-- 
2.35.3




More information about the Linux-nvme mailing list