public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: fix cached zone reports on devices with native zone append
@ 2025-12-10  2:10 Johannes Thumshirn
  2025-12-10  4:33 ` Damien Le Moal
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2025-12-10  2:10 UTC (permalink / raw)
  To: axboe@kernel.dk
  Cc: linux-block, Damien Le Moal, Naohiro Aota, Johannes Thumshirn

When mounting a btrfs file system on virtio-blk which supports native
Zone Append there has been a WARN triggering in btrfs' space management
code.

Further looking into btrfs' zoned statistics uncovered the filesystem
expecting the zones to be used, but the write pointers being 0:
 # cat /sys/fs/btrfs/8eabd2e7-3294-4f9e-9b58-7e64135c8bf4/zoned_stats
 active block-groups: 4
         reclaimable: 0
         unused: 0
         need reclaim: false
 data relocation block-group: 1342177280
 active zones:
         start: 1073741824, wp: 0 used: 0, reserved: 0, unusable: 0
         start: 1342177280, wp: 0 used: 0, reserved: 0, unusable: 0
         start: 1610612736, wp: 0 used: 16384, reserved: 0, unusable: 18446744073709535232
         start: 1879048192, wp: 0 used: 131072, reserved: 0, unusable: 18446744073709420544

Looking at the blkzone report output for the zone in question
(1610612736) the write pointer on the device moved, but the filesystem
did not see a change on the write pointer:
 # blkzone report -c 1 -o 0x300000 /dev/vda
   start: 0x000300000, len 0x080000, cap 0x080000, wptr 0x000040 reset:0 non-seq:0, zcond: 2(oi) [type: 2(SEQ_WRITE_REQUIRED)]

The zone write pointer is 0, because btrfs is using the cached version
of blkdev_report_zones() and as virtio-blk is supporting native zone
append, but blkdev_revalidate_zones() does not initialize the zone write
plugs in this case.

Not skipping the revalidate of sequential zones in
blkdev_revalidate_zones() callchain fixes this issue.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

---
Note I'll also be sending a regression test to blktest for this issue.
---
 block/blk-zoned.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index dcc295721c2c..831113667679 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -2096,7 +2096,7 @@ static int blk_revalidate_seq_zone(struct blk_zone *zone, unsigned int idx,
 	 * we have a zone write plug for such zone if the device has a zone
 	 * write plug hash table.
 	 */
-	if (!queue_emulates_zone_append(disk->queue) || !disk->zone_wplugs_hash)
+	if (!disk->zone_wplugs_hash)
 		return 0;
 
 	wp_offset = disk_zone_wplug_sync_wp_offset(disk, zone);
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] block: fix cached zone reports on devices with native zone append
  2025-12-10  2:10 [PATCH] block: fix cached zone reports on devices with native zone append Johannes Thumshirn
@ 2025-12-10  4:33 ` Damien Le Moal
  2025-12-10  5:27 ` Christoph Hellwig
  2025-12-10  5:37 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Damien Le Moal @ 2025-12-10  4:33 UTC (permalink / raw)
  To: Johannes Thumshirn, axboe@kernel.dk; +Cc: linux-block, Naohiro Aota

On 2025/12/09 18:10, Johannes Thumshirn wrote:
> When mounting a btrfs file system on virtio-blk which supports native
> Zone Append there has been a WARN triggering in btrfs' space management
> code.
> 
> Further looking into btrfs' zoned statistics uncovered the filesystem
> expecting the zones to be used, but the write pointers being 0:
>  # cat /sys/fs/btrfs/8eabd2e7-3294-4f9e-9b58-7e64135c8bf4/zoned_stats
>  active block-groups: 4
>          reclaimable: 0
>          unused: 0
>          need reclaim: false
>  data relocation block-group: 1342177280
>  active zones:
>          start: 1073741824, wp: 0 used: 0, reserved: 0, unusable: 0
>          start: 1342177280, wp: 0 used: 0, reserved: 0, unusable: 0
>          start: 1610612736, wp: 0 used: 16384, reserved: 0, unusable: 18446744073709535232
>          start: 1879048192, wp: 0 used: 131072, reserved: 0, unusable: 18446744073709420544
> 
> Looking at the blkzone report output for the zone in question
> (1610612736) the write pointer on the device moved, but the filesystem
> did not see a change on the write pointer:
>  # blkzone report -c 1 -o 0x300000 /dev/vda
>    start: 0x000300000, len 0x080000, cap 0x080000, wptr 0x000040 reset:0 non-seq:0, zcond: 2(oi) [type: 2(SEQ_WRITE_REQUIRED)]
> 
> The zone write pointer is 0, because btrfs is using the cached version
> of blkdev_report_zones() and as virtio-blk is supporting native zone
> append, but blkdev_revalidate_zones() does not initialize the zone write
> plugs in this case.
> 
> Not skipping the revalidate of sequential zones in
> blkdev_revalidate_zones() callchain fixes this issue.

May be here, add: Adding zone write plugs for active zones is not an issue
because these plugs will be removed if the user issues a zone append command and
this same operation will also disable the cached report zones.

> 
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

Maybe also add a fixes tag for completeness ?

Other than that, looks OK to me.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>

-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] block: fix cached zone reports on devices with native zone append
  2025-12-10  2:10 [PATCH] block: fix cached zone reports on devices with native zone append Johannes Thumshirn
  2025-12-10  4:33 ` Damien Le Moal
@ 2025-12-10  5:27 ` Christoph Hellwig
  2025-12-10  5:37 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2025-12-10  5:27 UTC (permalink / raw)
  To: Johannes Thumshirn
  Cc: axboe@kernel.dk, linux-block, Damien Le Moal, Naohiro Aota

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] block: fix cached zone reports on devices with native zone append
  2025-12-10  2:10 [PATCH] block: fix cached zone reports on devices with native zone append Johannes Thumshirn
  2025-12-10  4:33 ` Damien Le Moal
  2025-12-10  5:27 ` Christoph Hellwig
@ 2025-12-10  5:37 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2025-12-10  5:37 UTC (permalink / raw)
  To: Johannes Thumshirn; +Cc: linux-block, Damien Le Moal, Naohiro Aota


On Wed, 10 Dec 2025 03:10:37 +0100, Johannes Thumshirn wrote:
> When mounting a btrfs file system on virtio-blk which supports native
> Zone Append there has been a WARN triggering in btrfs' space management
> code.
> 
> Further looking into btrfs' zoned statistics uncovered the filesystem
> expecting the zones to be used, but the write pointers being 0:
>  # cat /sys/fs/btrfs/8eabd2e7-3294-4f9e-9b58-7e64135c8bf4/zoned_stats
>  active block-groups: 4
>          reclaimable: 0
>          unused: 0
>          need reclaim: false
>  data relocation block-group: 1342177280
>  active zones:
>          start: 1073741824, wp: 0 used: 0, reserved: 0, unusable: 0
>          start: 1342177280, wp: 0 used: 0, reserved: 0, unusable: 0
>          start: 1610612736, wp: 0 used: 16384, reserved: 0, unusable: 18446744073709535232
>          start: 1879048192, wp: 0 used: 131072, reserved: 0, unusable: 18446744073709420544
> 
> [...]

Applied, thanks!

[1/1] block: fix cached zone reports on devices with native zone append
      commit: 2c38ec934ddfe2d35c813edea2674356bea0fabe

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-12-10  5:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-10  2:10 [PATCH] block: fix cached zone reports on devices with native zone append Johannes Thumshirn
2025-12-10  4:33 ` Damien Le Moal
2025-12-10  5:27 ` Christoph Hellwig
2025-12-10  5:37 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox