Skip to contentSkip to conversation

next-20260917 and next-20260918: merge of the block tree breaks all zoned devices

DISCUSSION Tao Cui 4 participants 9 messages Sep 20 – Sep 21

Subsystems (3)
lore
Share & tools
lore

Tao Cui

author
#0 lore raw

Hi Stephen,

I ran into this while testing a blk-iocost series of mine (charging zone appends as writes) against a zoned null_blk: the device simply does not show up, whether configured through module parameters or configfs. null_blk prints "using native zone append" and then add_disk() fails silently with -ENODEV.

My series only touches blk-iocost.c, and the failure reproduces on plain linux-next, so it is not mine. Bisecting over the tags (qemu, "null_blk.zoned=1 null_blk.gb=1 null_blk.zone_size=64" on the command line) narrows it down to one day:

next-20260916: nullb0 created, /sys/block/nullb0/queue/zoned = host-managed
next-20260917: no device, add_disk() fails
next-20260918: same failure

The only blk-zoned.c changes between next-20260916 and next-20260917 come in through the merge of the block tree, and next-20260918 repeats the same resolution in the same place:

66c8b6b56c09 ("Merge branch 'for-next' of .../axboe/linux.git", 2026-09-17) a9ce2250a714 ("Merge branch 'for-next' of .../axboe/linux.git", 2026-09-18)

As far as I can tell the resolved disk_revalidate_capacity() matches neither parent: it gains a

if (args->capacity >= args->nr_zones)

check that compares a sector count against a zone count, with args->nr_zones still 0 on the first call, so it always trips and blk_revalidate_disk_zones() always returns -ENODEV. The zone_sectors power-of-two check that both parents have is gone as well. This hits every zoned device, not just null_blk.

Taking the axboe side of the function makes nullb0 come back on next-20260918 here (host-managed, chunk_sectors 131072), so it looks like the merge should just have taken that side.

Same conflict, same bad outcome twice in a row now, so tomorrow's merge may hit it again unless the block tree has moved on in this area.

Regards,
Tao

#1 lore raw

Hi Tao,

Quoted 2 lines · On Sun, 20 Sep 2026 20:58:34 +0800 Tao Cui <[email protected]> wrote:

Hi Stephen,

I no longer run linux-next, please email Mark Brown (cc'd).

[The rest kept for Mark's benefit]

Quoted 44 lines

I ran into this while testing a blk-iocost series of mine (charging zone appends as writes) against a zoned null_blk: the device simply does not show up, whether configured through module parameters or configfs. null_blk prints "using native zone append" and then add_disk() fails silently with -ENODEV.

My series only touches blk-iocost.c, and the failure reproduces on plain linux-next, so it is not mine. Bisecting over the tags (qemu, "null_blk.zoned=1 null_blk.gb=1 null_blk.zone_size=64" on the command line) narrows it down to one day:

next-20260916: nullb0 created, /sys/block/nullb0/queue/zoned = host-managed
next-20260917: no device, add_disk() fails
next-20260918: same failure

The only blk-zoned.c changes between next-20260916 and next-20260917 come in through the merge of the block tree, and next-20260918 repeats the same resolution in the same place:

66c8b6b56c09 ("Merge branch 'for-next' of .../axboe/linux.git", 2026-09-17) a9ce2250a714 ("Merge branch 'for-next' of .../axboe/linux.git", 2026-09-18)

As far as I can tell the resolved disk_revalidate_capacity() matches neither parent: it gains a

if (args->capacity >= args->nr_zones)

check that compares a sector count against a zone count, with args->nr_zones still 0 on the first call, so it always trips and blk_revalidate_disk_zones() always returns -ENODEV. The zone_sectors power-of-two check that both parents have is gone as well. This hits every zoned device, not just null_blk.

Taking the axboe side of the function makes nullb0 come back on next-20260918 here (host-managed, chunk_sectors 131072), so it looks like the merge should just have taken that side.

Same conflict, same bad outcome twice in a row now, so tomorrow's merge may hit it again unless the block tree has moved on in this area.

Regards,
Tao

Signature · 2 lines
Cheers,
Stephen Rothwell
maintainer
#2 lore raw
Quoted 5 lines · Stephen Rothwell

On Sun, 20 Sep 2026 20:58:34 +0800 Tao Cui <[email protected]> wrote:

I no longer run linux-next, please email Mark Brown (cc'd).

[The rest kept for Mark's benefit]

Thanks.

Quoted 6 lines
Quoted 5 lines

I ran into this while testing a blk-iocost series of mine (charging zone appends as writes) against a zoned null_blk: the device simply does not show up, whether configured through module parameters or configfs. null_blk prints "using native zone append" and then add_disk() fails silently with -ENODEV.

Quoted 7 lines
Quoted 7 lines

Taking the axboe side of the function makes nullb0 come back on next-20260918 here (host-managed, chunk_sectors 131072), so it looks like the merge should just have taken that side.

Same conflict, same bad outcome twice in a row now, so tomorrow's merge may hit it again unless the block tree has moved on in this area.

I did say when I did that merge that I had no confidence in it but nobody responded. Can you please send me a commit on top of current -next which fixes up the resolution appropriately? I can drop extra fixups in relatively easily, it's probably safer to take something that you have tested.

maintainer
#3 lore raw
Quoted 5 lines · Mark Brown

I did say when I did that merge that I had no confidence in it but nobody responded. Can you please send me a commit on top of current -next which fixes up the resolution appropriately? I can drop extra fixups in relatively easily, it's probably safer to take something that you have tested.

Mark,

My apologies for not replying, but I was traveling. I had looked at your resolution but only quickly and I did not notice the incorrect comparison causing the issue.

I am attaching a diff that cleans up the conflict resolution.

Thanks!

Signature · 2 lines
Damien Le Moal
Western Digital Research
block/blk-zoned.c +7 -4
index bae48f0d3464..dd8a72e352c1 100644
@@ -2031,11 +2031,16 @@ void disk_init_zone_resources(struct gendisk *disk)
 static unsigned int disk_get_nr_zones(struct gendisk *disk, sector_t capacity)
 {
 	struct queue_limits *lim = &disk->queue->limits;
+	unsigned long long nr_zones;
 
 	if (!capacity || !lim->chunk_sectors)
 		return 0;
 
-	return DIV_ROUND_UP_ULL(capacity, lim->chunk_sectors);
+	nr_zones = DIV_ROUND_UP_ULL(capacity, lim->chunk_sectors);
+	if (nr_zones > UINT_MAX)
+		return 0;
+
+	return nr_zones;
 }
 
 /*
@@ -2197,7 +2202,7 @@ static int disk_init_revalidate_args(struct gendisk *disk,
 {
 	args->disk = disk;
 	args->nr_zones = disk_get_nr_zones(disk, args->capacity);
-	if (args->nr_zones > UINT_MAX)
+	if (!args->nr_zones)
 		return -EINVAL;
 
 	/* Cached zone conditions: 1 byte per zone */
@@ -2329,8 +2334,6 @@ static int disk_revalidate_capacity(struct gendisk *disk,
 	nr_zones = disk_get_nr_zones(disk, args->capacity);
 	if (!args->capacity || !nr_zones)
 		goto drop_all_zwplugs;
-	if (args->capacity >= args->nr_zones)
-		goto drop_all_zwplugs;
 
 	/*
 	 * Check if the capacity has changed. If it did, assume that the device
author Tested-by
#4 lore raw

Hi Mark, Damien,

Quoted 7 lines · Damien Le Moal
Quoted 5 lines · Mark Brown

I did say when I did that merge that I had no confidence in it but nobody responded. Can you please send me a commit on top of current -next which fixes up the resolution appropriately? I can drop extra fixups in relatively easily, it's probably safer to take something that you have tested.

Quoted 8 lines

Mark,

My apologies for not replying, but I was traveling. I had looked at your resolution but only quickly and I did not notice the incorrect comparison causing the issue.

I am attaching a diff that cleans up the conflict resolution.

I tested Damien's patch on top of next-20260918.

It restores the zoned null_blk here: nullb0 is created again, reports host-managed, and the queue chunk size is back to 131072 sectors (CONFIG_BLK_DEV_NULL_BLK=y, "null_blk.zoned=1 null_blk.gb=1 null_blk.zone_size=64" on the kernel command line). So this looks good to me.

One question for Damien while looking through the merged code: both parents had the power-of-two check for zone_sectors, but that check also disappears in the merged result. Was that removal intentional, or should it be restored as well?

Thanks.

Quoted 2 lines

Thanks!

maintainer
#5 lore raw
Quoted 27 lines · Tao Cui

Hi Mark, Damien,

Quoted 7 lines · Damien Le Moal
Quoted 5 lines · Mark Brown

I did say when I did that merge that I had no confidence in it but nobody responded. Can you please send me a commit on top of current -next which fixes up the resolution appropriately? I can drop extra fixups in relatively easily, it's probably safer to take something that you have tested.

Quoted 8 lines

Mark,

My apologies for not replying, but I was traveling. I had looked at your resolution but only quickly and I did not notice the incorrect comparison causing the issue.

I am attaching a diff that cleans up the conflict resolution.

I tested Damien's patch on top of next-20260918.

It restores the zoned null_blk here: nullb0 is created again, reports host-managed, and the queue chunk size is back to 131072 sectors (CONFIG_BLK_DEV_NULL_BLK=y, "null_blk.zoned=1 null_blk.gb=1 null_blk.zone_size=64" on the kernel command line). So this looks good to me.

Quoted 6 lines

One question for Damien while looking through the merged code: both parents had the power-of-two check for zone_sectors, but that check also disappears in the merged result. Was that removal intentional, or should it be restored as well?

Doh! Yes, you are absolutely correct.
I am going to do a manual merge to generate a proper conflict resolution.

Quoted 6 lines

Thanks.

Quoted 2 lines

Thanks!

Signature · 2 lines
Damien Le Moal
Western Digital Research
maintainer
#6 lore raw
In reply to Tao Cui
Quoted 27 lines · Tao Cui

Hi Mark, Damien,

Quoted 7 lines · Damien Le Moal
Quoted 5 lines · Mark Brown

I did say when I did that merge that I had no confidence in it but nobody responded. Can you please send me a commit on top of current -next which fixes up the resolution appropriately? I can drop extra fixups in relatively easily, it's probably safer to take something that you have tested.

Quoted 8 lines

Mark,

My apologies for not replying, but I was traveling. I had looked at your resolution but only quickly and I did not notice the incorrect comparison causing the issue.

I am attaching a diff that cleans up the conflict resolution.

I tested Damien's patch on top of next-20260918.

It restores the zoned null_blk here: nullb0 is created again, reports host-managed, and the queue chunk size is back to 131072 sectors (CONFIG_BLK_DEV_NULL_BLK=y, "null_blk.zoned=1 null_blk.gb=1 null_blk.zone_size=64" on the kernel command line). So this looks good to me.

Quoted 6 lines

One question for Damien while looking through the merged code: both parents had the power-of-two check for zone_sectors, but that check also disappears in the merged result. Was that removal intentional, or should it be restored as well?

Mark, Attaching a v2 diff for corrected the conflict resolution. This is on top of the current linux-next.

Thanks.

Signature · 2 lines
Damien Le Moal
Western Digital Research
block/blk-zoned.c +17 -5
index bae48f0d3464..19268afb8752 100644
@@ -2031,11 +2031,16 @@ void disk_init_zone_resources(struct gendisk *disk)
 static unsigned int disk_get_nr_zones(struct gendisk *disk, sector_t capacity)
 {
 	struct queue_limits *lim = &disk->queue->limits;
+	unsigned long long nr_zones;
 
 	if (!capacity || !lim->chunk_sectors)
 		return 0;
 
-	return DIV_ROUND_UP_ULL(capacity, lim->chunk_sectors);
+	nr_zones = DIV_ROUND_UP_ULL(capacity, lim->chunk_sectors);
+	if (nr_zones > UINT_MAX)
+		return 0;
+
+	return nr_zones;
 }
 
 /*
@@ -2197,8 +2202,8 @@ static int disk_init_revalidate_args(struct gendisk *disk,
 {
 	args->disk = disk;
 	args->nr_zones = disk_get_nr_zones(disk, args->capacity);
-	if (args->nr_zones > UINT_MAX)
-		return -EINVAL;
+	if (!args->nr_zones)
+		return -ENODEV;
 
 	/* Cached zone conditions: 1 byte per zone */
 	args->zones_state = kzalloc(args->nr_zones, GFP_NOIO);
@@ -2322,15 +2327,22 @@ static void disk_drop_zone_wplug(struct blk_zone_wplug *zwplug, void *data)
 static int disk_revalidate_capacity(struct gendisk *disk,
 				    struct blk_revalidate_zone_args *args)
 {
+	struct queue_limits *lim = &disk->queue->limits;
+        sector_t zone_sectors = lim->chunk_sectors;
 	unsigned int nr_zones;
 	int ret = -ENODEV;
 
+	/* Checks that the device driver indicated a valid zone size. */
+	if (!zone_sectors || !is_power_of_2(zone_sectors)) {
+		pr_warn("%s: Invalid non power of two zone size (%llu)\n",
+			disk->disk_name, zone_sectors);
+		goto drop_all_zwplugs;
+	}
+
 	args->capacity = get_capacity(disk);
 	nr_zones = disk_get_nr_zones(disk, args->capacity);
 	if (!args->capacity || !nr_zones)
 		goto drop_all_zwplugs;
-	if (args->capacity >= args->nr_zones)
-		goto drop_all_zwplugs;
 
 	/*
 	 * Check if the capacity has changed. If it did, assume that the device
maintainer
#8 lore raw
In reply to Damien Le Moal
Quoted 11 lines · Damien Le Moal
Quoted 5 lines · Mark Brown

I did say when I did that merge that I had no confidence in it but nobody responded. Can you please send me a commit on top of current -next which fixes up the resolution appropriately? I can drop extra fixups in relatively easily, it's probably safer to take something that you have tested.

My apologies for not replying, but I was traveling. I had looked at your resolution but only quickly and I did not notice the incorrect comparison causing the issue.

No worries, stuff happens - I was just surprised nobody complained about the merge TBH.

Quoted 1 line

I am attaching a diff that cleans up the conflict resolution.

Thanks, that should appear in today's -next all being well.

maintainer
#7 lore raw
In reply to Damien Le Moal
Quoted 2 lines · Damien Le Moal

Mark, Attaching a v2 diff for corrected the conflict resolution. This is on top of the current linux-next.

I've replaced the patch with this one.