From: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
To: Yi Zhang <yi.zhang@redhat.com>,
linux-block <linux-block@vger.kernel.org>,
"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Cc: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
Naohiro Aota <Naohiro.Aota@wdc.com>
Subject: Re: [bug report]kernel BUG at fs/btrfs/zoned.c:2587! triggered by blktests zbd/009
Date: Wed, 3 Sep 2025 10:40:46 +0000 [thread overview]
Message-ID: <44be7089-cd6c-40db-95c7-b31497afd5a0@wdc.com> (raw)
In-Reply-To: <CAHj4cs8-cS2E+-xQ-d2Bj6vMJZ+CwT_cbdWBTju4BV35LsvEYw@mail.gmail.com>
On 9/3/25 10:36 AM, Yi Zhang wrote:
> The kernel BUG was triggered by blktests zbd/009 on v6.17-rc3, please
> help check it and let me know if you need any infor/test for it,
> thanks.
[...]
> [ 319.819821] assertion failed: bg->zone_unusable == 0 :: 0, in
> fs/btrfs/zoned.c:2587
> [ 319.828449] ------------[ cut here ]------------
> [ 319.833618] kernel BUG at fs/btrfs/zoned.c:2587!
> [ 319.838793] Oops: invalid opcode: 0000 [#1] SMP KASAN PTI
> [ 319.844829] CPU: 3 UID: 0 PID: 1370 Comm: mount Tainted: G W
> ------ ---
> 6.17.0-0.rc3.250826gfab1beda7597.32.fc44.x86_64+debug #1 PREEMPT(lazy)
> [ 319.860948] Tainted: [W]=WARN
> [ 319.864259] Hardware name: Dell Inc. PowerEdge R730/0WCJNT, BIOS
> 2.19.0 12/12/2023
> [ 319.872704] RIP: 0010:btrfs_zoned_reserve_data_reloc_bg.cold+0xb2/0xb4
> [ 319.880014] Code: ab e8 7e ab f7 ff 0f 0b 41 b8 1b 0a 00 00 48 c7
> c1 80 9f 59 ab 31 d2 48 c7 c6 20 b8 59 ab 48 c7 c7 20 a0 59 ab e8 5a
> ab f7 ff <0f> 0b 41 b8 5f 0a 00 00 48 c7 c1 80 9f 59 ab 31 d2 48 c7 c6
> 00 b9
> [ 319.900977] RSP: 0018:ffffc9000c21f930 EFLAGS: 00010282
> [ 319.906816] RAX: 0000000000000047 RBX: ffff8888d1a54000 RCX: 0000000000000000
> [ 319.914783] RDX: 0000000000000047 RSI: 1ffffffff629cc84 RDI: fffff52001843f18
> [ 319.922742] RBP: ffff888121b7c000 R08: ffffffffa802cbb5 R09: fffff52001843edc
> [ 319.930709] R10: 0000000000000003 R11: 0000000000000001 R12: 0000000000000000
> [ 319.938666] R13: 0000000000000001 R14: ffff888121b7c128 R15: ffff88810f379800
> [ 319.946625] FS: 00007fbd89e98840(0000) GS:ffff8890af8e8000(0000)
> knlGS:0000000000000000
> [ 319.955661] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [ 319.962077] CR2: 0000559e0ad4b540 CR3: 00000008e14ce003 CR4: 00000000003726f0
> [ 319.970046] Call Trace:
> [ 319.972767] <TASK>
> [ 319.975102] ? create_space_info+0x155/0x390
> [ 319.979880] open_ctree+0x1874/0x2203
> [ 319.983977] btrfs_fill_super.cold+0x2c/0x16d
> [ 319.988850] btrfs_get_tree_super+0x936/0xd60
> [ 319.993725] btrfs_get_tree_subvol+0x230/0x5f0
>
OK the problem is, we're ASSERTing if zone_unusable is 0 and that
obviously fails, because zbd/009 configures scsi_debug with a zone_size
of 4MB and a zone_capacity of 3MB. This automatically leads to an
assertion failure as bg->zone_unusable is 1MB.
The test in there is to check if we have an empty block-group.
@Naohiro what do you think of the following:
diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index 6e66ec491181..f897f914b78e 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -2590,7 +2590,8 @@ void btrfs_zoned_reserve_data_reloc_bg(struct
btrfs_fs_info *fs_info)
space_info->disk_total -= bg->length * factor;
/* There is no allocation ever happened. */
ASSERT(bg->used == 0);
- ASSERT(bg->zone_unusable == 0);
+ ASSERT(bg->zone_unusable == 0 ||
+ bg->length - bg->zone_unusable ==
bg->zone_capacity);
/* No super block in a block group on the zoned
setup. */
ASSERT(bg->bytes_super == 0);
spin_unlock(&space_info->lock);
next prev parent reply other threads:[~2025-09-03 10:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-03 8:36 [bug report]kernel BUG at fs/btrfs/zoned.c:2587! triggered by blktests zbd/009 Yi Zhang
2025-09-03 10:40 ` Johannes Thumshirn [this message]
2025-09-04 2:45 ` Naohiro Aota
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=44be7089-cd6c-40db-95c7-b31497afd5a0@wdc.com \
--to=johannes.thumshirn@wdc.com \
--cc=Naohiro.Aota@wdc.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=shinichiro.kawasaki@wdc.com \
--cc=yi.zhang@redhat.com \
/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