Skip to content

Commit 59c0517

Browse files
Yao Sangkeithbusch
authored andcommitted
nvme: refresh multipath head zoned limits from path limits
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>
1 parent 0967074 commit 59c0517

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

drivers/nvme/host/core.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2491,6 +2491,14 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
24912491
return ret;
24922492
}
24932493

2494+
static void nvme_stack_zone_resources(struct queue_limits *t,
2495+
const struct queue_limits *b)
2496+
{
2497+
t->max_open_zones = min_not_zero(t->max_open_zones, b->max_open_zones);
2498+
t->max_active_zones =
2499+
min_not_zero(t->max_active_zones, b->max_active_zones);
2500+
}
2501+
24942502
static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_ns_info *info)
24952503
{
24962504
bool unsupported = false;
@@ -2557,6 +2565,8 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_ns_info *info)
25572565
lim.io_opt = ns_lim->io_opt;
25582566
queue_limits_stack_bdev(&lim, ns->disk->part0, 0,
25592567
ns->head->disk->disk_name);
2568+
if (lim.features & BLK_FEAT_ZONED)
2569+
nvme_stack_zone_resources(&lim, ns_lim);
25602570
if (unsupported)
25612571
ns->head->disk->flags |= GENHD_FL_HIDDEN;
25622572
else

0 commit comments

Comments
 (0)