[PATCH] nvme-multipath: fix multipath path scan

Kanchan Joshi joshi.k at samsung.com
Tue Feb 15 22:13:05 PST 2022


commit e7d65803e2bb ("nvme-multipath: revalidate paths during rescan")
introduced NVME_NS_READY flag. nvme_path_is_disabled() declares path/ns
to be disabled if this flag is not found to be set.
This causes side-effect on namespace for which block-interface is not
fully up.

> nvme id-ns /dev/ng1n1
identify namespace: Resource temporarily unavailable

Above issue occurs because nvme_find_path() fails as it does not find
the NVME_NS_READY set.

       ns = nvme_find_path(head);
       if (!ns)
                goto out_unlock;

Go back to old behaviour by moving up setting of NVME_NS_READY.

After this patch:
> nvme id-ns /dev/ng1n1
NVME Identify Namespace 1:
nsze    : 0x3cf00000
ncap    : 0x3cf00000
nuse    : 0
...........

Fixes: e7d65803e2bb ("nvme-multipath: revalidate paths during rescan")
Signed-off-by: Kanchan Joshi <joshi.k at samsung.com>
---
 drivers/nvme/host/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 961a5f8a44d2..71c1970f029d 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1914,6 +1914,7 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id)
 	blk_mq_freeze_queue(ns->disk->queue);
 	ns->lba_shift = id->lbaf[lbaf].ds;
 	nvme_set_queue_limits(ns->ctrl, ns->queue);
+	set_bit(NVME_NS_READY, &ns->flags);
 
 	ret = nvme_configure_metadata(ns, id);
 	if (ret)
@@ -1927,7 +1928,6 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id)
 			goto out_unfreeze;
 	}
 
-	set_bit(NVME_NS_READY, &ns->flags);
 	blk_mq_unfreeze_queue(ns->disk->queue);
 
 	if (blk_queue_is_zoned(ns->queue)) {
-- 
2.25.1




More information about the Linux-nvme mailing list