------------[ cut here ]------------ kernel BUG at fs/bcachefs/alloc_foreground.c:489! Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP Modules linked in: CPU: 1 PID: 10617 Comm: syz.4.535 Not tainted 6.10.0-rc7-syzkaller-gc912bf709078 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024 pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : bch2_bucket_alloc_freelist fs/bcachefs/alloc_foreground.c:489 [inline] pc : bch2_bucket_alloc_trans+0x298c/0x29e4 fs/bcachefs/alloc_foreground.c:649 lr : bch2_bucket_alloc_freelist fs/bcachefs/alloc_foreground.c:489 [inline] lr : bch2_bucket_alloc_trans+0x298c/0x29e4 fs/bcachefs/alloc_foreground.c:649 sp : ffff800098615660 x29: ffff800098615ca0 x28: dfff800000000000 x27: ffff800098615bd0 x26: ffff0000d7628000 x25: ffff800098615900 x24: ffff0000d7628008 x23: 1fffe0001aec5000 x22: 0000000000000000 x21: 0000000000000000 x20: ffff0000d928c138 x19: 0000000000000019 x18: ffff800098615a0d x17: 000000000003f51f x16: ffff80008af004c0 x15: 000000000000000d x14: 1ffff000130c2b68 x13: 0000000000000000 x12: 0000000000000000 x11: ffff7000130c2b75 x10: 0000000000ff0100 x9 : 0000000000000000 x8 : ffff0000d31c1e40 x7 : 0000000000000000 x6 : 0000000000000000 x5 : ffff800098616090 x4 : 0000000000000000 x3 : 0000000000000020 x2 : 0000000000000008 x1 : 0000000000000019 x0 : 0000000000000000 Call trace: bch2_bucket_alloc_freelist fs/bcachefs/alloc_foreground.c:489 [inline] bch2_bucket_alloc_trans+0x298c/0x29e4 fs/bcachefs/alloc_foreground.c:649 bch2_bucket_alloc_set_trans+0x490/0x9e4 fs/bcachefs/alloc_foreground.c:810 __open_bucket_add_buckets+0xfb4/0x18b4 fs/bcachefs/alloc_foreground.c:1058 open_bucket_add_buckets+0x160/0x220 fs/bcachefs/alloc_foreground.c:1102 bch2_alloc_sectors_start_trans+0xa74/0x1958 __bch2_write+0x5c4/0x47f4 fs/bcachefs/io_write.c:1438 bch2_write+0x8bc/0x153c 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+0x224/0x304 fs/bcachefs/fs-io-buffered.c:652 do_writepages+0x2f8/0x7c4 mm/page-writeback.c:2656 filemap_fdatawrite_wbc+0x124/0x174 mm/filemap.c:397 __filemap_fdatawrite_range mm/filemap.c:430 [inline] file_write_and_wait_range+0x178/0x260 mm/filemap.c:788 bch2_fsync+0x94/0x144 fs/bcachefs/fs-io.c:197 vfs_fsync_range+0x168/0x188 fs/sync.c:188 generic_write_sync include/linux/fs.h:2794 [inline] bch2_buffered_write fs/bcachefs/fs-io-buffered.c:1128 [inline] bch2_write_iter+0x2990/0x2d24 fs/bcachefs/fs-io-buffered.c:1136 new_sync_write fs/read_write.c:497 [inline] vfs_write+0x8f8/0xc38 fs/read_write.c:590 ksys_pwrite64 fs/read_write.c:705 [inline] __do_sys_pwrite64 fs/read_write.c:715 [inline] __se_sys_pwrite64 fs/read_write.c:712 [inline] __arm64_sys_pwrite64+0x188/0x220 fs/read_write.c:712 __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:48 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:131 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:150 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 Code: 978ef2c9 17fffedf 95615aba 977aeaa1 (d4210000) ---[ end trace 0000000000000000 ]---