Closed morbidrsa closed 2 years ago
Here's the stack trace
generic/068 [ 1.398244] run fstests generic/068 at 2022-03-07 13:17:03
[ 12.527832] assertion failed: start >= found_start && end <= found_end, in fs/btrfs/free-space-tree.c:737
[ 12.528876] ------------[ cut here ]------------
[ 12.529399] kernel BUG at fs/btrfs/ctree.h:3551!
[ 12.529908] invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
[ 12.530381] CPU: 0 PID: 694 Comm: kworker/u4:3 Not tainted 5.17.0-rc6-dennis #84
[ 12.531160] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1.fc35 04/01/2014
[ 12.531960] Workqueue: events_unbound btrfs_reclaim_bgs_work [btrfs]
[ 12.532614] RIP: 0010:assertfail.constprop.0+0x18/0x1a [btrfs]
[ 12.533182] Code: 9a 26 1b a0 48 c7 c7 70 d8 1b a0 e8 84 02 43 e1 0f 0b 89 f1 48 c7 c2 cd 26 1b a0 48 89 fe 48 c7 c7 98 d8 1b a0 e8 6a 02 43 e1 <0f> 0b be 8c 00 00 00 48 c7 c7 f9 26 1b a0 e8 d5 ff ff ff be 91 00
[ 12.533391] RSP: 0018:ffffc90000cffa58 EFLAGS: 00010282
[ 12.533391] RAX: 000000000000005d RBX: 0000000063f5c000 RCX: 0000000000000000
[ 12.533391] RDX: 0000000000000001 RSI: 00000000ffffffea RDI: 00000000ffffffff
[ 12.533391] RBP: ffff888116a59400 R08: ffffffff81ea4f88 R09: 00000000ffffefff
[ 12.533391] R10: ffffffff81e34fa0 R11: ffffffff81e34fa0 R12: ffff888114d42460
[ 12.533391] R13: ffff88810045ddd0 R14: 0000000063f9d000 R15: ffff88810408e800
[ 12.533391] FS: 0000000000000000(0000) GS:ffff888627c00000(0000) knlGS:0000000000000000
[ 12.533391] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 12.533391] CR2: 00007f36a24d9000 CR3: 00000001518d0000 CR4: 00000000000006b0
[ 12.533391] Call Trace:
[ 12.533391] <TASK>
[ 12.533391] __remove_from_free_space_tree.cold+0x11/0x22 [btrfs]
[ 12.542073] ? setup_items_for_insert.isra.0+0x2bf/0x3f0 [btrfs]
[ 12.542073] remove_from_free_space_tree+0x80/0x110 [btrfs]
[ 12.542073] alloc_reserved_file_extent+0x1b4/0x240 [btrfs]
[ 12.542073] __btrfs_run_delayed_refs+0x692/0xf30 [btrfs]
[ 12.542073] ? btrfs_btree_balance_dirty+0x2f/0x50 [btrfs]
[ 12.542073] btrfs_run_delayed_refs+0x81/0x1e0 [btrfs]
[ 12.542073] btrfs_commit_transaction+0x54/0xaf0 [btrfs]
[ 12.542073] ? start_transaction+0xc2/0x5b0 [btrfs]
[ 12.542073] ? _raw_read_lock_irqsave+0x20/0x40
[ 12.542073] relocate_block_group+0x320/0x550 [btrfs]
[ 12.542073] btrfs_relocate_block_group+0x1f9/0x3a0 [btrfs]
[ 12.542073] btrfs_relocate_chunk+0x36/0xf0 [btrfs]
[ 12.542073] btrfs_reclaim_bgs_work.cold+0x4f/0x74 [btrfs]
[ 12.542073] process_one_work+0x1b0/0x310
[ 12.542073] worker_thread+0x48/0x3d0
[ 12.542073] ? rescuer_thread+0x3a0/0x3a0
[ 12.542073] kthread+0xed/0x120
[ 12.550506] ? kthread_complete_and_exit+0x20/0x20
[ 12.550506] ret_from_fork+0x22/0x30
[ 12.550506] </TASK>
[ 12.550506] Modules linked in: btrfs blake2b_generic xor lzo_compress zlib_deflate raid6_pq zstd_decompress zstd_compress xxhash null_blk
[ 12.553118] ---[ end trace 0000000000000000 ]---
[ 12.553574] RIP: 0010:assertfail.constprop.0+0x18/0x1a [btrfs]
[ 12.554206] Code: 9a 26 1b a0 48 c7 c7 70 d8 1b a0 e8 84 02 43 e1 0f 0b 89 f1 48 c7 c2 cd 26 1b a0 48 89 fe 48 c7 c7 98 d8 1b a0 e8 6a 02 43 e1 <0f> 0b be 8c 00 00 00 48 c7 c7 f9 26 1b a0 e8 d5 ff ff ff be 91 00
[ 12.556091] RSP: 0018:ffffc90000cffa58 EFLAGS: 00010282
[ 12.556570] RAX: 000000000000005d RBX: 0000000063f5c000 RCX: 0000000000000000
[ 12.557269] RDX: 0000000000000001 RSI: 00000000ffffffea RDI: 00000000ffffffff
[ 12.557940] RBP: ffff888116a59400 R08: ffffffff81ea4f88 R09: 00000000ffffefff
[ 12.558629] R10: ffffffff81e34fa0 R11: ffffffff81e34fa0 R12: ffff888114d42460
[ 12.559319] R13: ffff88810045ddd0 R14: 0000000063f9d000 R15: ffff88810408e800
[ 12.560014] FS: 0000000000000000(0000) GS:ffff888627c00000(0000) knlGS:0000000000000000
[ 12.560766] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 12.561329] CR2: 00007f36a24d9000 CR3: 00000001518d0000 CR4: 00000000000006b0
While it can be interesting to trace what happening here, but I just want to disable FREESPACE_TREE on zoned btrfs in the first place.
Since we do the simple sequential allocation, it's no use to maintain the tree. And, actually, I think the zoned allocator is not doing the maintenance correctly.
It should be fixed with 343d8a30851c ("btrfs: zoned: prevent allocation from previous data relocation BG")
When running fstetsts' generic/068 on zoned null_blk devices, with zone-size 128M, zone-capacity 64M and a max-active-zones value of 14 triggers the following ASSERT() in remove_free_space_extent():
Here's a preliminary analysis with gdb in the moment the ASSERT() has triggered.