public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Naohiro Aota <naohiro.aota@wdc.com>
To: linux-btrfs@vger.kernel.org
Cc: Naohiro Aota <naohiro.aota@wdc.com>
Subject: [PATCH v2 0/2] btrfs: zoned: fix removing of unwritten non-data block group
Date: Fri, 11 Jul 2025 16:11:18 +0900	[thread overview]
Message-ID: <cover.1752217584.git.naohiro.aota@wdc.com> (raw)

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


             reply	other threads:[~2025-07-11  7:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-11  7:11 Naohiro Aota [this message]
2025-07-11  7:11 ` [PATCH v2 1/2] btrfs: zoned: do not remove unwritten non-data block group 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1752217584.git.naohiro.aota@wdc.com \
    --to=naohiro.aota@wdc.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox