Kernel bug: kernel BUG in bch2_fs_initialize
Subsystem: bcachefs
Status: fixed

Crash report:
2097051 pages RAM
0 pages HighMem/MovableOnly
428634 pages reserved
0 pages cma reserved
bcachefs (loop3): error reallocating journal fifo (32768 open entries)
------------[ cut here ]------------
kernel BUG at fs/bcachefs/journal.h:442!
Oops: invalid opcode: 0000 [#1] SMP KASAN PTI
CPU: 1 UID: 0 PID: 6088 Comm: syz.3.19 Not tainted 6.15.0-rc1-next-20250411-syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
RIP: 0010:bch2_journal_set_replay_done fs/bcachefs/journal.h:442 [inline]
RIP: 0010:bch2_fs_initialize+0x15f9/0x1620 fs/bcachefs/recovery.c:1130
Code: ff e8 8b c6 a8 07 44 89 f1 80 e1 07 80 c1 03 38 c1 0f 8c 04 fe ff ff 4c 89 f7 e8 b2 55 a3 fd e9 f7 fd ff ff e8 08 1e 39 fd 90 <0f> 0b e8 00 1e 39 fd e8 fb 47 a3 fd 4c 89 ff 8b 74 24 38 e8 bf 3f
RSP: 0000:ffffc90002eaf420 EFLAGS: 00010293
RAX: ffffffff848a5c38 RBX: 0000000000000000 RCX: ffff8880260e1e00
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc90002eaf920 R08: ffffffff848a505e R09: 1ffff1100bbb92c0
R10: dffffc0000000000 R11: ffffed100bbb92c1 R12: ffff88805dd80000
R13: ffff88805dd80820 R14: ffff88805ddc9600 R15: ffff88805ddc95c0
FS:  00007f78569b26c0(0000) GS:ffff888125080000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f2b312d9000 CR3: 00000000651f4000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 bch2_fs_start+0x301/0x620 fs/bcachefs/super.c:1100
 bch2_fs_get_tree+0x1138/0x18e0 fs/bcachefs/fs.c:2253
 vfs_get_tree+0x90/0x2b0 fs/super.c:1809
 do_new_mount+0x2cf/0xb70 fs/namespace.c:3879
 do_mount fs/namespace.c:4219 [inline]
 __do_sys_mount fs/namespace.c:4430 [inline]
 __se_sys_mount+0x38c/0x400 fs/namespace.c:4407
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f7855b8e90a
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 1a 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 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:00007f78569b1e68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f78569b1ef0 RCX: 00007f7855b8e90a
RDX: 0000200000000000 RSI: 0000200000000180 RDI: 00007f78569b1eb0
RBP: 0000200000000000 R08: 00007f78569b1ef0 R09: 0000000000000010
R10: 0000000000000010 R11: 0000000000000246 R12: 0000200000000180
R13: 00007f78569b1eb0 R14: 00000000000059f8 R15: 00002000000001c0
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:bch2_journal_set_replay_done fs/bcachefs/journal.h:442 [inline]
RIP: 0010:bch2_fs_initialize+0x15f9/0x1620 fs/bcachefs/recovery.c:1130
Code: ff e8 8b c6 a8 07 44 89 f1 80 e1 07 80 c1 03 38 c1 0f 8c 04 fe ff ff 4c 89 f7 e8 b2 55 a3 fd e9 f7 fd ff ff e8 08 1e 39 fd 90 <0f> 0b e8 00 1e 39 fd e8 fb 47 a3 fd 4c 89 ff 8b 74 24 38 e8 bf 3f
RSP: 0000:ffffc90002eaf420 EFLAGS: 00010293
RAX: ffffffff848a5c38 RBX: 0000000000000000 RCX: ffff8880260e1e00
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc90002eaf920 R08: ffffffff848a505e R09: 1ffff1100bbb92c0
R10: dffffc0000000000 R11: ffffed100bbb92c1 R12: ffff88805dd80000
R13: ffff88805dd80820 R14: ffff88805ddc9600 R15: ffff88805ddc95c0
FS:  00007f78569b26c0(0000) GS:ffff888125080000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007efd4804d000 CR3: 00000000651f4000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400