Skip to contentSkip to conversation

block: stack zoned resource limits

PATCH In review Yao Sang 3 participants 3 messages May 20 – May 31 Block layer

lore
Share & tools
lore

Yao Sang

author
#0 lore raw

PATCH 1/1 block: stack zoned resource limits

This was found while debugging a zoned NVMe multipath setup, where the namespace head reported 0/0 for max_open_zones and max_active_zones while the live path still reported finite limits.

blk_stack_limits() already combines several zoned queue limits, but it leaves max_open_zones and max_active_zones unchanged. Since 0 means "no limit" for both values, stacked zoned devices can preserve bogus 0/0 limits even when the underlying queue advertises finite values.

Stack max_open_zones and max_active_zones with min_not_zero(), and clear them when the resulting queue is not zoned.

---
 block/blk-settings.c | 6 ++++++
 1 file changed, 6 insertions(+)
block/blk-settings.c +6 -0
index 78c83817b9d3..88b6c3703101 100644
@@ -814,6 +814,10 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
 
 	t->max_hw_zone_append_sectors = min(t->max_hw_zone_append_sectors,
 					b->max_hw_zone_append_sectors);
+	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);
 
 	t->seg_boundary_mask = min_not_zero(t->seg_boundary_mask,
 					    b->seg_boundary_mask);
@@ -921,6 +925,8 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
 	t->zone_write_granularity = max(t->zone_write_granularity,
 					b->zone_write_granularity);
 	if (!(t->features & BLK_FEAT_ZONED)) {
+		t->max_open_zones = 0;
+		t->max_active_zones = 0;
 		t->zone_write_granularity = 0;
 		t->max_zone_append_sectors = 0;
 	}
Signature · 1 line
2.25.1
#1 lore raw
Quoted 9 lines · Yao Sang

This was found while debugging a zoned NVMe multipath setup, where the namespace head reported 0/0 for max_open_zones and max_active_zones while the live path still reported finite limits.

blk_stack_limits() already combines several zoned queue limits, but it leaves max_open_zones and max_active_zones unchanged. Since 0 means "no limit" for both values, stacked zoned devices can preserve bogus 0/0 limits even when the underlying queue advertises finite values.

Quoted 4 lines

Stack max_open_zones and max_active_zones with min_not_zero(), and clear them when the resulting queue is not zoned.

Hello Yao,

Blktest CI system found that this patch makes the test case zbd/011 fail [1]. The header comment of the test case explains how max_open_zones and max_active_zones should be handled [2]. You may also want to check the corresponding kernel side commit 73a74af0c72b ("dm: Improve zone resource limits handling").

[1]

$ sudo ./check zbd/011
Memory leak detected before test run start. See '/home/shin/Blktests/blktests/results/start.kmemleak'.
zbd/011 (DM zone resource limits stacking)                   [failed]
    runtime  9.791s  ...  10.764s
    --- tests/zbd/011.out       2025-04-22 13:13:27.805873155 +0900
    +++ /home/shin/Blktests/blktests/results/nodev/zbd/011.out.bad      2026-05-21 12:49:44.398000000 +0900
    @@ -1,2 +1,13 @@
     Running zbd/011
    +Invalid max active zones limit: 64 should be 0
    +Test 9 failed: Map 32 CNV zones of the 1st nullb and all SWR zones of the 2nd nullb
    +Invalid max active zones limit: 64 should be 0
    +Test 11 failed: Map 32 SWR zones of the 1st nullb and all SWR zones of the 2nd nullb
    +Invalid max open zones limit: 48 should be 64
    +Test 12 failed: Map 128 SWR zones of the 1st nullb and 16 SWR zones of the 2nd nullb
    ...
    (Run 'diff -u tests/zbd/011.out /home/shin/Blktests/blktests/results/nodev/zbd/011.out.bad' to see the entire diff)

[2] https://github.com/linux-blktests/blktests/blob/master/tests/zbd/011

#2 lore raw
In reply to Yao Sang
kernel test robot noticed "blktests.zbd/011.fail" on:

Hello,

kernel test robot noticed "blktests.zbd/011.fail" on:

commit: c17db973b5faf59694eda2e4ea164b29b69c8973 ("[PATCH] block: stack zoned resource limits")
url: https://github.com/intel-lab-lkp/linux/commits/Yao-Sang/block-stack-zoned-resource-limits/20260520-174028
base: https://git.kernel.org/cgit/linux/kernel/git/axboe/linux.git for-next
patch link: https://lore.kernel.org/all/[email protected]/
patch subject: [PATCH] block: stack zoned resource limits

in testcase: blktests
version: blktests-x86_64-9131687-1_20260529
with following parameters:

	test: zbd-011

config: x86_64-rhel-9.4-func
compiler: gcc-14
test machine: 4 threads Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz (Skylake) with 32G memory

(please refer to attached dmesg/kmsg for entire log/backtrace)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-lkp/[email protected]

2026-05-29 09:25:41 cd /lkp/benchmarks/blktests

Defaulting to policy_version 2 because kernel supports it.
Customizing passphrase hashing difficulty for this system...
Created global config file at "/etc/fscrypt.conf".
Allow users other than root to create fscrypt metadata on the root filesystem?
(See https://github.com/google/fscrypt#setting-up-fscrypt-on-a-filesystem) [y/N] Metadata directories created at "/.fscrypt", writable by root only.

2026-05-29 09:25:47 echo zbd/011
2026-05-29 09:25:47 ./check zbd/011

zbd/011 (DM zone resource limits stacking)
zbd/011 (DM zone resource limits stacking) [failed]
runtime ... 6.852s
--- tests/zbd/011.out 2026-05-29 06:56:18.000000000 +0000
+++ /lkp/benchmarks/blktests/results/nodev/zbd/011.out.bad 2026-05-29 09:25:54.319411071 +0000
@@ -1,2 +1,13 @@
Running zbd/011
+Invalid max active zones limit: 64 should be 0
+Test 9 failed: Map 32 CNV zones of the 1st nullb and all SWR zones of the 2nd nullb +Invalid max active zones limit: 64 should be 0
+Test 11 failed: Map 32 SWR zones of the 1st nullb and all SWR zones of the 2nd nullb +Invalid max open zones limit: 48 should be 64
+Test 12 failed: Map 128 SWR zones of the 1st nullb and 16 SWR zones of the 2nd nullb
...
(Run 'diff -u tests/zbd/011.out /lkp/benchmarks/blktests/results/nodev/zbd/011.out.bad' to see the entire diff)

The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20260531/[email protected]

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki