[PATCH v4] nvme: refresh multipath head zoned limits from path limits

Yao Sang sangyao at kylinos.cn
Thu May 28 00:36:01 PDT 2026


queue_limits_stack_bdev() updates the multipath head limits from the
path queue, but it does not propagate max_open_zones or
max_active_zones. As a result, a zoned multipath namespace head can
keep stale 0/0 values even after a ready path reports finite zoned
resource limits.

When refreshing the head limits in nvme_update_ns_info(), stack the
zoned resource limits directly after stacking the path queue limits.
Use min_not_zero() so the block layer's 0 value keeps its "no limit"
meaning while finite limits are combined conservatively.

This avoids advertising "no limit" on the multipath head while keeping
the zoned-limit handling local to the NVMe multipath update path.

Signed-off-by: Yao Sang <sangyao at kylinos.cn>
---
Changes since v3:
- Factor the zoned-limit update into nvme_stack_zone_resources(), as
  suggested in review.

Testing:
- blktests: nvme/005, nvme/057, nvme/058
- blktests: zbd/011, zbd/012, zbd/013, block/004
- blktests on /dev/nvme0n1: zbd/001, zbd/002, zbd/003, zbd/004,
  zbd/005, zbd/006

Link to v1:
https://lore.kernel.org/r/20260520091237.392802-1-sangyao@kylinos.cn

Link to v2:
https://lore.kernel.org/r/20260522075806.3168366-1-sangyao@kylinos.cn

Link to v3:
https://lore.kernel.org/r/20260526072529.1086128-1-sangyao@kylinos.cn

 drivers/nvme/host/core.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index c3032d6ad6b1..8450ec0d84a6 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2483,6 +2483,14 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
 	return ret;
 }
 
+static void nvme_stack_zone_resources(struct queue_limits *t,
+				      const struct queue_limits *b)
+{
+	t->max_open_zones = min_not_zero(t->max_open_zones, b->max_open_zones);
+	t->max_active_zones =
+		min_not_zero(t->max_active_zones, b->max_active_zones);
+}
+
 static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_ns_info *info)
 {
 	bool unsupported = false;
@@ -2549,6 +2557,8 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_ns_info *info)
 		lim.io_opt = ns_lim->io_opt;
 		queue_limits_stack_bdev(&lim, ns->disk->part0, 0,
 					ns->head->disk->disk_name);
+		if (lim.features & BLK_FEAT_ZONED)
+			nvme_stack_zone_resources(&lim, ns_lim);
 		if (unsupported)
 			ns->head->disk->flags |= GENHD_FL_HIDDEN;
 		else
-- 
2.25.1




More information about the Linux-nvme mailing list