nvme: warn about shared namespaces without CONFIG_NVME_MULTIPATH
authorChristoph Hellwig <hch@lst.de>
Tue, 15 Mar 2022 12:27:07 +0000 (13:27 +0100)
committerChristoph Hellwig <hch@lst.de>
Wed, 16 Mar 2022 15:48:00 +0000 (16:48 +0100)
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>
drivers/block/loop.c
drivers/nvme/host/core.c

index 8fb89d0..e733c48 100644 (file)
@@ -2092,6 +2092,7 @@ static void loop_remove(struct loop_device *lo)
        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);
index c868015..3c04611 100644 (file)
@@ -3855,6 +3855,14 @@ static int nvme_init_ns_head(struct nvme_ns *ns, unsigned nsid,
                                        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);