[PATCH 2/2] nvme: print warning on non-unique namespace identifier

Bryan Gurney bgurney at redhat.com
Fri May 9 08:16:59 PDT 2025


If a duplicate ID is detected, print a warning about a suspected
firmware bug, that a non-unique identifier was found.

Reviewed-by: John Meneghini <jmeneghi at redhat.com>
Signed-off-by: Bryan Gurney <bgurney at redhat.com>
---
 drivers/nvme/host/core.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 49ca29c64ca9..5670c25d1144 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3579,8 +3579,11 @@ static int nvme_subsys_check_duplicate_ids(struct nvme_subsystem *subsys,
 
 	if (has_uuid) {
 		list_for_each_entry(h, &subsys->nsheads, entry)
-			if (uuid_equal(&ids->uuid, &h->ids.uuid))
+			if (uuid_equal(&ids->uuid, &h->ids.uuid)) {
+				dev_warn(&subsys->dev,
+					 "firmware bug: non-unique uuid found\n");
 				return -EINVAL;
+			}
 		return 0;
 	}
 
@@ -3588,8 +3591,11 @@ static int nvme_subsys_check_duplicate_ids(struct nvme_subsystem *subsys,
 		list_for_each_entry(h, &subsys->nsheads, entry)
 			if (memcmp(&ids->nguid,
 				   &h->ids.nguid,
-				   sizeof(ids->nguid)) == 0)
+				   sizeof(ids->nguid)) == 0) {
+				dev_warn(&subsys->dev,
+					 "firmware bug: non-unique nguid found\n");
 				return -EINVAL;
+			}
 		return 0;
 	}
 
@@ -3597,8 +3603,11 @@ static int nvme_subsys_check_duplicate_ids(struct nvme_subsystem *subsys,
 		list_for_each_entry(h, &subsys->nsheads, entry)
 			if (memcmp(&ids->eui64,
 				   &h->ids.eui64,
-				   sizeof(ids->eui64)) == 0)
+				   sizeof(ids->eui64)) == 0) {
+				dev_warn(&subsys->dev,
+					 "firmware bug: non-unique eui64 found\n");
 				return -EINVAL;
+			}
 		return 0;
 	}
 
-- 
2.49.0




More information about the Linux-nvme mailing list