[PATCH 4/4] nvme: add mulitipath warning to nvme_alloc_ns

John Meneghini jmeneghi at redhat.com
Thu Feb 27 19:25:41 PST 2025


When CONFIG_NVME_MULTIPATH is disabled, add a warning if
we discover a multipath enabled controller with an attached
shared namespace.

Signed-off-by: John Meneghini <jmeneghi at redhat.com>
---
 drivers/nvme/host/core.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index c2b7e6834535..465069c0f6a8 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3938,6 +3938,15 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, struct nvme_ns_info *info)
 	} else {
 		sprintf(disk->disk_name, "nvme%dn%d", ctrl->instance,
 			ns->head->instance);
+#ifndef CONFIG_NVME_MULTIPATH
+		if ((ctrl->subsys->cmic & NVME_CTRL_CMIC_MULTI_CTRL) && info->is_shared) {
+			dev_warn(ctrl->device,
+				"Found shared namespace %d but multipathing not supported.\n",
+				info->nsid);
+			dev_warn_once(ctrl->device,
+				"Shared namespace support requires CONFIG_NVME_MULTIPATH.\n");
+		}
+#endif
 	}
 
 	if (nvme_update_ns_info(ns, info))
-- 
2.48.1




More information about the Linux-nvme mailing list