------------[ cut here ]------------ kernel BUG at fs/bcachefs/alloc_foreground.c:493! Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN NOPTI CPU: 0 UID: 0 PID: 11 Comm: kworker/u4:0 Not tainted 6.12.0-rc7-syzkaller-00042-gf1b785f4c787 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Workqueue: btree_node_rewrite async_btree_node_rewrite_work RIP: 0010:bch2_bucket_alloc_freelist fs/bcachefs/alloc_foreground.c:493 [inline] RIP: 0010:bch2_bucket_alloc_trans+0x39ec/0x3a50 fs/bcachefs/alloc_foreground.c:648 Code: e8 f9 38 f0 fd e9 f0 c7 ff ff 89 d9 80 e1 07 38 c1 0f 8c f3 fd ff ff 48 89 df e8 8f 37 f0 fd e9 e6 fd ff ff e8 a5 6d 86 fd 90 <0f> 0b e8 9d 6d 86 fd 90 0f 0b e8 85 1a b9 07 f3 0f 1e fa e8 8c 6d RSP: 0018:ffffc900003d6140 EFLAGS: 00010293 RAX: ffffffff840e7c6b RBX: 0000000000000019 RCX: ffff88801b742440 RDX: 0000000000000000 RSI: 0000000000000019 RDI: 0000000000000000 RBP: ffffc900003d6868 R08: ffffffff840e4f39 R09: 0000000000000000 R10: ffffc900003d6728 R11: fffff5200007acea R12: dffffc0000000000 R13: ffff88804edc0000 R14: 0000000000000000 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff88801fc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000558875390058 CR3: 0000000040968000 CR4: 0000000000352ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: bch2_bucket_alloc_set_trans+0x517/0xd30 fs/bcachefs/alloc_foreground.c:808 __open_bucket_add_buckets+0x13d0/0x1ec0 fs/bcachefs/alloc_foreground.c:1057 open_bucket_add_buckets+0x33a/0x410 fs/bcachefs/alloc_foreground.c:1101 bch2_alloc_sectors_start_trans+0xce9/0x2030 __bch2_btree_node_alloc fs/bcachefs/btree_update_interior.c:339 [inline] bch2_btree_reserve_get+0x612/0x1890 fs/bcachefs/btree_update_interior.c:549 bch2_btree_update_start+0xe56/0x14e0 fs/bcachefs/btree_update_interior.c:1247 bch2_btree_node_rewrite+0x1c0/0x1280 fs/bcachefs/btree_update_interior.c:2148 async_btree_node_rewrite_trans fs/bcachefs/btree_update_interior.c:2236 [inline] async_btree_node_rewrite_work+0x31e/0xda0 fs/bcachefs/btree_update_interior.c:2249 process_one_work kernel/workqueue.c:3229 [inline] process_scheduled_works+0xa63/0x1850 kernel/workqueue.c:3310 worker_thread+0x870/0xd30 kernel/workqueue.c:3391 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:bch2_bucket_alloc_freelist fs/bcachefs/alloc_foreground.c:493 [inline] RIP: 0010:bch2_bucket_alloc_trans+0x39ec/0x3a50 fs/bcachefs/alloc_foreground.c:648 Code: e8 f9 38 f0 fd e9 f0 c7 ff ff 89 d9 80 e1 07 38 c1 0f 8c f3 fd ff ff 48 89 df e8 8f 37 f0 fd e9 e6 fd ff ff e8 a5 6d 86 fd 90 <0f> 0b e8 9d 6d 86 fd 90 0f 0b e8 85 1a b9 07 f3 0f 1e fa e8 8c 6d RSP: 0018:ffffc900003d6140 EFLAGS: 00010293 RAX: ffffffff840e7c6b RBX: 0000000000000019 RCX: ffff88801b742440 RDX: 0000000000000000 RSI: 0000000000000019 RDI: 0000000000000000 RBP: ffffc900003d6868 R08: ffffffff840e4f39 R09: 0000000000000000 R10: ffffc900003d6728 R11: fffff5200007acea R12: dffffc0000000000 R13: ffff88804edc0000 R14: 0000000000000000 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff88801fc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000558875390058 CR3: 0000000011e28000 CR4: 0000000000352ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400