Skip to contentSkip to conversation

nvme: don't create a multipath node for zero capacity devices

PATCH Applied Christoph Hellwig 4 participants 4 messages Apr 3, 2024 – Apr 4, 2024 NVMe

lore
Share & tools
lore

Christoph Hellwig

author maintainer
#0 lore raw

PATCH 1/1 nvme: don't create a multipath node for zero capacity devices

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")
---
 drivers/nvme/host/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/core.c +1 -1
index 3b0498f320e6b9..ad60cf5581a419 100644
@@ -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);
Signature · 1 line
2.39.2
Tested-by on v1 1/1
#1 lore raw
Quoted 17 lines · Christoph Hellwig

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")
---
 drivers/nvme/host/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/core.c +0 -0
index 3b0498f320e6b9..ad60cf5581a419 100644

drivers/nvme/host/core.c static int nvme_update_ns_info_block(struct nvme_ns *ns, · line 2095

Quoted 8 lines
drivers/nvme/host/core.c +1 -1
@@ -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);

I have tested patch on my controller with zero capacity namespaces. This looks good and fixing the issue reported here:
https://lore.kernel.org/all/[email protected]/

Thanks,
--Nilay

Reviewed-by on v1 1/1
#2 lore raw
In reply to Christoph Hellwig
Quoted 11 lines · Christoph Hellwig

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")
---
  drivers/nvme/host/core.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Looks good.

-ck

maintainer Applied
#3 lore raw
In reply to Christoph Hellwig
Quoted 4 lines · Christoph Hellwig

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.

Thanks, applied to nvme-6.9.