public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] btrfs: zoned: fix removing of unwritten non-data block group
@ 2025-07-11  7:11 Naohiro Aota
  2025-07-11  7:11 ` [PATCH v2 1/2] btrfs: zoned: do not remove " Naohiro Aota
  2025-07-11  7:11 ` [PATCH v2 2/2] btrfs: zoned: requeue to unused block group list if zone finish failed Naohiro Aota
  0 siblings, 2 replies; 5+ messages in thread
From: Naohiro Aota @ 2025-07-11  7:11 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Naohiro Aota

There are some reports of "unable to find chunk map for logical 2147483648
length 16384" error message appears in the dmesg. This means some IOs are
occurring after a block group is removed.

The IOs are coming from unused dirty tree nodes. When a metadata tree
node is cleaned on the zoned setup, we keep that node still dirty and
write it out not to create a write hole. When user operation e.g,
fsync() is fast enough, we can have a block group full of "unused dirty"
tree nodes. Such block group has its used count == 0, making it "unused"
block group and candidate for removal.

Removing the block group keeps the dirty nodes unsent until next sync or
umount operation. At that time, such nodes will cause the "unable to
find chunk map" failures.

This sympton can happen relatively easy on SMR, whose zone size ==
256MB, but it is hidden coincidently hitting a check in
do_zone_finish(). Hitting the check remove the block group from the
unused list and let it never reclaimed, which itself is a problem.

Fix them adding an extra check in the BG removal process and put a block
group in the retry list when btrfs_zone_finish() returns -EAGAIN.

Changes:
- v2
 - Refine has_unwritten_metadata() structure.
 - Add message when hitting the WARN_ON.

Naohiro Aota (2):
  btrfs: zoned: do not remove unwritten non-data block group
  btrfs: zoned: requeue to unused block group list if zone finish failed

 fs/btrfs/block-group.c | 31 ++++++++++++++++++++++++++++---
 1 file changed, 28 insertions(+), 3 deletions(-)

-- 
2.50.0


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

end of thread, other threads:[~2025-07-11  8:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-11  7:11 [PATCH v2 0/2] btrfs: zoned: fix removing of unwritten non-data block group Naohiro Aota
2025-07-11  7:11 ` [PATCH v2 1/2] btrfs: zoned: do not remove " Naohiro Aota
2025-07-11  8:10   ` Johannes Thumshirn
2025-07-11  7:11 ` [PATCH v2 2/2] btrfs: zoned: requeue to unused block group list if zone finish failed Naohiro Aota
2025-07-11  8:12   ` Johannes Thumshirn

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