public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Naohiro Aota <Naohiro.Aota@wdc.com>
To: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH v2 2/3] btrfs: zoned: fix write time activation failure for metadata block group
Date: Mon, 14 Jul 2025 00:50:02 +0000	[thread overview]
Message-ID: <DBBD621D5H7O.BYB40GHYOA4G@wdc.com> (raw)
In-Reply-To: <6d2f4c04-c401-41ea-8acb-d633262428f3@wdc.com>

On Fri Jul 11, 2025 at 7:52 PM JST, Johannes Thumshirn wrote:
> On 11.07.25 09:24, Naohiro Aota wrote:
>> +	if (block_group->flags & BTRFS_BLOCK_GROUP_DATA) {
>> +		/* The caller should check if the block group is full. */
>> +		if (WARN_ON_ONCE(btrfs_zoned_bg_is_full(block_group))) {
>
> I get that WARN_ON() triggering when running fio benchmarks:
>
>
> [ 2054.634831] RIP: 0010:btrfs_zone_activate+0x1e0/0x220 [btrfs]
> [ 2054.660477] RSP: 0018:ffffd20f0bd039b8 EFLAGS: 00010246
> [ 2054.666069] RAX: 0000000010000000 RBX: ffff8b7d98747c00 RCX: ffff8b7d4729f508
> [ 2054.673576] RDX: 0000000000000001 RSI: 0000000000000004 RDI: ffff8b7d98747c10
> [ 2054.681069] RBP: 0000000000000000 R08: ffff8b7d5c13b000 R09: 0000000000000000
> [ 2054.688563] R10: ffff8b9c88239480 R11: 0000000000000001 R12: ffff8b7d5c13b000
> [ 2054.696050] R13: ffff8b7d5315b000 R14: ffff8b7d47389400 R15: 0000000000001000
> [ 2054.703546] FS:  00007ff45a4b2840(0000) GS:ffff8b9d02a7e000(0000) knlGS:0000000000000000
> [ 2054.711989] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [ 2054.718090] CR2: 000056051a88df6c CR3: 000000034dbc0000 CR4: 0000000000350ef0
> [ 2054.725581] Call Trace:
> [ 2054.728392]  <TASK>
> [ 2054.730854]  ? srso_return_thunk+0x5/0x5f
> [ 2054.735233]  ? btrfs_zoned_reserve_data_reloc_bg+0x77/0x230 [btrfs]
> [ 2054.741915]  open_ctree+0x7e9/0xb40 [btrfs]
>
> But before that I see write time errors:
>
> [  203.230377] BTRFS info (device sdh): host-managed zoned block device /dev/sdh, 111760 zones of 268435456 bytes
> [  203.240465] BTRFS info (device sdh): zoned mode enabled with zone size 268435456
> [  203.251064] BTRFS info (device sdh): checking UUID tree
> [ 1958.689947] sdh: zone 1324: Aborting plugged BIOs
> [ 1958.694697] BTRFS error (device sdh): bdev /dev/sdh errs: wr 1, rd 0, flush 0, corrupt 0, gen 0
> [ 1958.703428] BTRFS error (device sdh): bdev /dev/sdh errs: wr 2, rd 0, flush 0, corrupt 0, gen 0
> [ 1958.712157] BTRFS error (device sdh): bdev /dev/sdh errs: wr 3, rd 0, flush 0, corrupt 0, gen 0
> [ 1958.720881] BTRFS error (device sdh): bdev /dev/sdh errs: wr 4, rd 0, flush 0, corrupt 0, gen 0
> [ 1958.729614] BTRFS error (device sdh): bdev /dev/sdh errs: wr 5, rd 0, flush 0, corrupt 0, gen 0
> [ 1958.738345] BTRFS error (device sdh): bdev /dev/sdh errs: wr 6, rd 0, flush 0, corrupt 0, gen 0
> [ 1958.747072] BTRFS error (device sdh): bdev /dev/sdh errs: wr 7, rd 0, flush 0, corrupt 0, gen 0
> [ 1958.755798] BTRFS error (device sdh): bdev /dev/sdh errs: wr 8, rd 0, flush 0, corrupt 0, gen 0
> [ 1958.764525] BTRFS error (device sdh): bdev /dev/sdh errs: wr 9, rd 0, flush 0, corrupt 0, gen 0
> [ 1958.773257] BTRFS error (device sdh): bdev /dev/sdh errs: wr 10, rd 0, flush 0, corrupt 0, gen 0
> [ 1959.306908] BTRFS error (device sdh state A): Transaction aborted (error -5)
> [ 1959.314030] BTRFS: error (device sdh state A) in __btrfs_update_delayed_inode:1015: errno=-5 IO failure
> [ 1959.323481] BTRFS info (device sdh state EA): forced readonly
> [ 1959.536934] sdh: zone 1325: Aborting plugged BIOs
>
>
> This is with today's for-next and the two patch sets of you applied. Will dig deeper.

Ah, yes. I know this issue. This happens because
btrfs_zoned_reserve_data_reloc_bg() uses "if (bg->used > 0)" to choose
(skip) a block group to be reserved. If a block group is fully allocated
and get unused, bg->used == 0 && bg->alloc_offset != 0. Since, reserving
this block group itself is an issue. I should have included the fix for
this. I'll update this series to include the fix.

  reply	other threads:[~2025-07-14  0:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-11  7:23 [PATCH v2 0/3] btrfs: zoned: limitt active zones to max_open_zones Naohiro Aota
2025-07-11  7:23 ` [PATCH v2 1/3] btrfs: zoned: do not select metadata BG as finish target Naohiro Aota
2025-07-11  7:23 ` [PATCH v2 2/3] btrfs: zoned: fix write time activation failure for metadata block group Naohiro Aota
2025-07-11  8:16   ` Johannes Thumshirn
2025-07-11 10:52   ` Johannes Thumshirn
2025-07-14  0:50     ` Naohiro Aota [this message]
2025-07-11  7:23 ` [PATCH v2 3/3] btrfs: zoned: limit active zones to max_open_zones Naohiro Aota
2025-07-11  8:25   ` Johannes Thumshirn
2025-07-11  8:33     ` 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=DBBD621D5H7O.BYB40GHYOA4G@wdc.com \
    --to=naohiro.aota@wdc.com \
    --cc=Johannes.Thumshirn@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