[PATCH 05/19] nvme-multipath: add nvme_mpath_available_path()
From: John Garry
Date: Wed Feb 25 2026 - 11:07:44 EST
This is for mpath_head_template.available_path callback.
Currently the same functionality is in nvme_available_path().
Signed-off-by: John Garry <john.g.garry@xxxxxxxxxx>
---
drivers/nvme/host/multipath.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index 390a1d1133921..e888791b8947a 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -510,6 +510,26 @@ static bool nvme_available_path(struct nvme_ns_head *head)
return nvme_mpath_queue_if_no_path(head);
}
+static bool nvme_mpath_available_path(struct mpath_device *mpath_device,
+ bool *available)
+{
+ struct nvme_ns *ns = nvme_mpath_to_ns(mpath_device);
+
+ if (test_bit(NVME_CTRL_FAILFAST_EXPIRED, &ns->ctrl->flags))
+ return false;
+
+ switch (nvme_ctrl_state(ns->ctrl)) {
+ case NVME_CTRL_LIVE:
+ case NVME_CTRL_RESETTING:
+ case NVME_CTRL_CONNECTING:
+ *available = true;
+ default:
+ break;
+ }
+
+ return true;
+}
+
static void nvme_ns_head_submit_bio(struct bio *bio)
{
struct nvme_ns_head *head = bio->bi_bdev->bd_disk->private_data;
@@ -1412,4 +1432,5 @@ void nvme_mpath_uninit(struct nvme_ctrl *ctrl)
__maybe_unused
static const struct mpath_head_template mpdt = {
+ .available_path = nvme_mpath_available_path,
};
--
2.43.5