]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
nvme: refresh multipath head zoned limits from path limits
authorYao Sang <sangyao@kylinos.cn>
Thu, 28 May 2026 07:36:01 +0000 (15:36 +0800)
committerKeith Busch <kbusch@kernel.org>
Tue, 2 Jun 2026 12:30:59 +0000 (05:30 -0700)
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.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Yao Sang <sangyao@kylinos.cn>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/host/core.c

index ea837b94d3e51e9f727e7ad0d92b1d58c0ac9830..cad9d973526153359a6d1f0c9126a236d65f1ec0 100644 (file)
@@ -2491,6 +2491,14 @@ out:
        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;
@@ -2557,6 +2565,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