Re: [PATCH 0/2] btrfs: zoned: fix silent data loss from leaked active zone reservation
From: Марк Коренберг
Date: Thu Oct 29 2026 - 06:06:59 EST
Adding Johannes, as this overlaps with his recent zoned work.
A few notes on how this series relates to what is in btrfs for-next and
on the list:
- The series is based on master, but it applies cleanly to btrfs
for-next as of today (c393445c12fc), only with line offsets.
- 0be761ecf1a9 ("btrfs: zoned: only change active zone counter on
successful (de)activation") in for-next does not cover the leak fixed
by patch 1: the block group removed by relocation gets its active bit
cleared by the zone reset in btrfs_relocate_chunk_finish(), but
reserved_active_zones is only given back in call_zone_finish(), which
never runs for it.
- Patch 2 makes btrfs_zone_finish_one_bg() the normal path again when
buffered writeback runs out of active zones with a negative
reservation (cow_file_range() -> btrfs_reserve_extent() ->
find_free_extent() -> btrfs_zone_finish_one_bg()). That is the path
of the deadlock fixed by "btrfs: zoned: don't wait for ordered extents
in do_zone_finish()" (30c6d31da683 in for-next), so for stable patch 2
should go together with that one.
- Patch 1 and "[PATCH v6 21/25] btrfs: zoned: reuse block groups emptied
by reclaim as relocation target" both change
btrfs_relocate_chunk_finish(). The conflict is trivial, and the two
fit together: btrfs_zoned_can_reuse_bg() requires the block group not
to be active, which patch 1 makes sure of, so the
btrfs_zone_finish_relocated() call has to stay before the reuse check.
I can resend the series on top of for-next, or on top of the generic/747
series, if that makes it easier to take.
Thanks,
Mark