nvme: don't create a multipath node for zero capacity devices
authorChristoph Hellwig <hch@lst.de>
Wed, 3 Apr 2024 12:47:17 +0000 (14:47 +0200)
committerKeith Busch <kbusch@kernel.org>
Thu, 4 Apr 2024 15:33:15 +0000 (08:33 -0700)
Apparently there are nvme controllers around that report namespaces
in the namespace list which have zero capacity.  Return -ENXIO instead
of -ENODEV from nvme_update_ns_info_block so we don't create a hidden
multipath node for these namespaces but entirely ignore them.

Fixes: 46e7422cda84 ("nvme: move common logic into nvme_update_ns_info")
Reported-by: Nilay Shroff <nilay@linux.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: Nilay Shroff <nilay@linux.ibm.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/host/core.c

index 504dc352c458dda0c00688d49e0c4e2dba6186df..27281a9a8951dbd53f30a27a14e0ac0be9a35c5d 100644 (file)
@@ -2089,7 +2089,7 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
        if (id->ncap == 0) {
                /* namespace not allocated or attached */
                info->is_removed = true;
-               ret = -ENODEV;
+               ret = -ENXIO;
                goto out;
        }
        lbaf = nvme_lbaf_index(id->flbas);