[SPDK] Re: nvme_bdev_add_ns: *ERROR*: Namespaces are not identical.

lullajd at yahoo.com Mon, 22 Nov 2021 07:24:16 +0000
Newsgroups dev.linux.lists.spdk
Message-ID <[email protected]>
Hi Shuhei, 
Thankyou for responding.

What NVMe-oF target are you using? SPDK NVMe-oF tatrget?
JL===> Its a private target implementation which has been tested thoroughly with linux kernel based initiator. The failover (when one controller becomes unavailable) also on this private target implementation works smoothly with linux kernel based initiator. 

The bdev conf you provided looks good.  
We need multiple namespaces to have the same NSID, EUI64, NGUID, and UUID to configure shared namespace.  
JL=====> Yes, is there anything I need to put in the bdev conf file to let the check in bdev_nvme_compare_ns()  pass ?
There seems to some issue with bdev_nvme_compare_ns().
I added some prints to check why this check is returning 0 to its callers
nvme_bdev_add_ns
nvme_ctrlr_populate_namespace
nvme_ctrlr_populate_namespaces
nvme_ctrlr_create_done
..
..



static bool
bdev_nvme_compare_ns(struct spdk_nvme_ns *ns1, struct spdk_nvme_ns *ns2)
{
        const struct spdk_nvme_ns_data *nsdata1, *nsdata2;
        const struct spdk_uuid *uuid1, *uuid2;

        nsdata1 = spdk_nvme_ns_get_data(ns1);
        nsdata2 = spdk_nvme_ns_get_data(ns2);
        uuid1 = spdk_nvme_ns_get_uuid(ns1);
        uuid2 = spdk_nvme_ns_get_uuid(ns2);
        if (uuid1 == NULL)
                printf("%s uuid1 is NULL\n", __func__);
        if (uuid2 == NULL)
                printf("%s uuid2 is NULL\n", __func__);
        printf("%s (memcmp(nsdata1->nguid, nsdata2->nguid, sizeof(nsdata1->nguid)) == 0):%d\n",
                        __func__,
              (memcmp(nsdata1->nguid, nsdata2->nguid, sizeof(nsdata1->nguid)) == 0));
        printf("%s (nsdata1->eui64 == nsdata2->eui64):%d\n", __func__,
                                (nsdata1->eui64 == nsdata2->eui64));
        unsigned char myexp;
        myexp = memcmp(nsdata1->nguid, nsdata2->nguid, sizeof(nsdata1->nguid)) == 0 &&
                nsdata1->eui64 == nsdata2->eui64 &&
                uuid1 != NULL && uuid2 != NULL && spdk_uuid_compare(uuid1, uuid2) == 0;
        printf("%s myexp:%d\n", __func__, myexp);

        return memcmp(nsdata1->nguid, nsdata2->nguid, sizeof(nsdata1->nguid)) == 0 &&
               nsdata1->eui64 == nsdata2->eui64 &&
               uuid1 != NULL && uuid2 != NULL && spdk_uuid_compare(uuid1, uuid2) == 0;
}




its printing the following:
bdev_nvme_compare_ns uuid1 is NULL
bdev_nvme_compare_ns uuid2 is NULL
bdev_nvme_compare_ns (memcmp(nsdata1->nguid, nsdata2->nguid, sizeof(nsdata1->nguid)) == 0):1
bdev_nvme_compare_ns (nsdata1->eui64 == nsdata2->eui64):1
bdev_nvme_compare_ns myexp:0
[2021-11-22 07:03:58.083035] bdev_nvme.c:2569:nvme_bdev_add_ns: *ERROR*: Namespaces are not identical.



If you are using SPDK NVMe-oF target, https://review.spdk.io/gerrit/c/spdk/spdk/+/10197/13 may give you a hint.  
Thanks, Shuhei