Blob Blame History Raw
From: Christoph Hellwig <hch@lst.de>
Date: Tue, 15 Mar 2022 13:27:07 +0100
Subject: nvme: warn about shared namespaces without CONFIG_NVME_MULTIPATH
Patch-mainline: v5.18-rc1
Git-commit: ce8d78616a6b637d1b763eb18e32045687a84305
References: jsc#PED-1183

Start warning about exposing a namespace as multiple block devices,
and set a fixed deprecation release.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Acked-by: Daniel Wagner <dwagner@suse.de>
---
 drivers/block/loop.c     |    1 +
 drivers/nvme/host/core.c |    8 ++++++++
 2 files changed, 9 insertions(+)

--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -2080,6 +2080,7 @@ static void loop_remove(struct loop_devi
 	del_gendisk(lo->lo_disk);
 	blk_cleanup_disk(lo->lo_disk);
 	blk_mq_free_tag_set(&lo->tag_set);
+
 	mutex_lock(&loop_ctl_mutex);
 	idr_remove(&loop_index_idr, lo->lo_number);
 	mutex_unlock(&loop_ctl_mutex);
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3854,6 +3854,14 @@ static int nvme_init_ns_head(struct nvme
 					nsid);
 			goto out_put_ns_head;
 		}
+
+		if (!multipath && !list_empty(&head->list)) {
+			dev_warn(ctrl->device,
+				"Found shared namespace %d, but multipathing not supported.\n",
+				nsid);
+			dev_warn_once(ctrl->device,
+				"Support for shared namespaces without CONFIG_NVME_MULTIPATH is deprecated and will be removed in Linux 6.0\n.");
+		}
 	}
 
 	list_add_tail_rcu(&ns->siblings, &head->list);