Saw I/O errors while delete/create/attach a namespace on nvme device.

Chaitanya Kulkarni chaitanyak at nvidia.com
Tue Nov 7 02:25:22 PST 2023


On 11/7/23 00:56, Christoph Hellwig wrote:
> On Mon, Nov 06, 2023 at 10:10:33PM -0600, Wen Xiong wrote:
>> Hi All,
>>
>> I am working on new nvme device and found this: nguid is changed while
>> delete/create/attach a namespace, we saw some error messages in linux log.
>>
>> Should we see these errors messages since recreating namespaces or are there
>> some issues in error path?
> What exactly are you doing?  To the Linux host code this looks like the
> NGUID changed for an existing namespace.  Are you deleting and
> recreating nsid1 rapidly and the controller is assigning a different
> nguid?
>
>

exactly "identifiers changed for nsid XXX" comes from nvme_validate_ns()
and the only caller is nvme_scan_ns() where ns is present, so scan ns
found the namespace and nvme_ns_ids_eaqual() returned an error hence 2nd 
print
message, but as said earlier we really need to see the exact steps ...

To check exactly which id is problematic something like in [1] can be
used, totally untested ...

-ck

[1]

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 75a1b58a7a43..84651c922548 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1749,10 +1749,23 @@ static void nvme_config_discard(struct gendisk 
*disk, struct nvme_ns *ns)

  static bool nvme_ns_ids_equal(struct nvme_ns_ids *a, struct 
nvme_ns_ids *b)
  {
-       return uuid_equal(&a->uuid, &b->uuid) &&
-               memcmp(&a->nguid, &b->nguid, sizeof(a->nguid)) == 0 &&
-               memcmp(&a->eui64, &b->eui64, sizeof(a->eui64)) == 0 &&
-               a->csi == b->csi;
+       if (uuid_equal(&a->uuid, &b->uuid) == false) {
+               pr_info("uuid mismatch\n");
+               return false;
+       }
+       if (memcmp(&a->nguid, &b->nguid, sizeof(a->nguid)) != 0) {
+               pr_info("nguid mismatch\n");
+               return false;
+       }
+       if (memcmp(&a->eui64, &b->eui64, sizeof(a->eui64)) != 0) {
+               pr_info("euid64 mismaatch\n");
+               return false;
+       }
+       if (a->csi != b->csi) {
+               pr_info("csi mismatch\n");
+               return false;
+       }
+       return true;
  }

  static int nvme_init_ms(struct nvme_ns *ns, struct nvme_id_ns *id)




More information about the Linux-nvme mailing list