------------[ cut here ]------------ kernel BUG at fs/bcachefs/alloc_foreground.c:489! Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI CPU: 0 PID: 5994 Comm: syz.0.116 Not tainted 6.10.0-rc6-syzkaller-00215-g22f902dfc51e #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024 RIP: 0010:bch2_bucket_alloc_freelist fs/bcachefs/alloc_foreground.c:489 [inline] RIP: 0010:bch2_bucket_alloc_trans+0x3ac8/0x3b30 fs/bcachefs/alloc_foreground.c:649 Code: 2e 7c f5 fd e9 07 c7 ff ff 44 89 f1 80 e1 07 38 c1 0f 8c fe fd ff ff 4c 89 f7 e8 c3 7a f5 fd e9 f1 fd ff ff e8 99 0f 93 fd 90 <0f> 0b e8 91 0f 93 fd 90 0f 0b e8 59 1e 7a 07 f3 0f 1e fa e8 80 0f RSP: 0018:ffffc900045dda00 EFLAGS: 00010287 RAX: ffffffff84031727 RBX: 0000000000000019 RCX: 0000000000040000 RDX: ffffc900040b1000 RSI: 000000000000ce4c RDI: 000000000000ce4d RBP: ffffc900045de130 R08: ffffffff8402e8f3 R09: 0000000000000000 R10: ffffc900045ddfe8 R11: fffff520008bbc02 R12: 0000000000000019 R13: dffffc0000000000 R14: 0000000000000000 R15: 0000000000000000 FS: 00007f5c475de6c0(0000) GS:ffff8880b9400000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fd45bb01018 CR3: 000000005d836000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: bch2_bucket_alloc_set_trans+0x4f9/0xcf0 fs/bcachefs/alloc_foreground.c:810 __open_bucket_add_buckets+0x11ed/0x1c80 fs/bcachefs/alloc_foreground.c:1058 open_bucket_add_buckets+0x174/0x230 fs/bcachefs/alloc_foreground.c:1102 bch2_alloc_sectors_start_trans+0xcaf/0x1f60 __bch2_write+0x75b/0x5c40 fs/bcachefs/io_write.c:1438 bch2_write+0x947/0x1670 fs/bcachefs/io_write.c:1634 closure_queue include/linux/closure.h:269 [inline] closure_call include/linux/closure.h:425 [inline] bch2_writepage_do_io fs/bcachefs/fs-io-buffered.c:460 [inline] bch2_writepages+0x27d/0x380 fs/bcachefs/fs-io-buffered.c:652 do_writepages+0x359/0x870 mm/page-writeback.c:2656 filemap_fdatawrite_wbc+0x125/0x180 mm/filemap.c:397 __filemap_fdatawrite_range mm/filemap.c:430 [inline] file_write_and_wait_range+0x1aa/0x290 mm/filemap.c:788 bch2_fsync+0x93/0x130 fs/bcachefs/fs-io.c:197 generic_write_sync include/linux/fs.h:2794 [inline] bch2_buffered_write fs/bcachefs/fs-io-buffered.c:1128 [inline] bch2_write_iter+0x262e/0x2840 fs/bcachefs/fs-io-buffered.c:1136 do_iter_readv_writev+0x5a4/0x800 vfs_writev+0x37c/0xbb0 fs/read_write.c:971 do_pwritev fs/read_write.c:1072 [inline] __do_sys_pwritev fs/read_write.c:1119 [inline] __se_sys_pwritev fs/read_write.c:1114 [inline] __x64_sys_pwritev+0x1c7/0x2d0 fs/read_write.c:1114 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f5c46775bd9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f5c475de048 EFLAGS: 00000246 ORIG_RAX: 0000000000000128 RAX: ffffffffffffffda RBX: 00007f5c46903f60 RCX: 00007f5c46775bd9 RDX: 0000000000000001 RSI: 0000000020000180 RDI: 0000000000000005 RBP: 00007f5c467e4aa1 R08: 0000000000000000 R09: 0000000000000000 R10: 000000000000c774 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f5c46903f60 R15: 00007ffec7241318 Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:bch2_bucket_alloc_freelist fs/bcachefs/alloc_foreground.c:489 [inline] RIP: 0010:bch2_bucket_alloc_trans+0x3ac8/0x3b30 fs/bcachefs/alloc_foreground.c:649 Code: 2e 7c f5 fd e9 07 c7 ff ff 44 89 f1 80 e1 07 38 c1 0f 8c fe fd ff ff 4c 89 f7 e8 c3 7a f5 fd e9 f1 fd ff ff e8 99 0f 93 fd 90 <0f> 0b e8 91 0f 93 fd 90 0f 0b e8 59 1e 7a 07 f3 0f 1e fa e8 80 0f RSP: 0018:ffffc900045dda00 EFLAGS: 00010287 RAX: ffffffff84031727 RBX: 0000000000000019 RCX: 0000000000040000 RDX: ffffc900040b1000 RSI: 000000000000ce4c RDI: 000000000000ce4d RBP: ffffc900045de130 R08: ffffffff8402e8f3 R09: 0000000000000000 R10: ffffc900045ddfe8 R11: fffff520008bbc02 R12: 0000000000000019 R13: dffffc0000000000 R14: 0000000000000000 R15: 0000000000000000 FS: 00007f5c475de6c0(0000) GS:ffff8880b9400000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fd45bb01018 CR3: 000000005d836000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400