Kernel bug: kernel BUG in bch2_lru_change (2)
Subsystem: bcachefs
Status: fixed

Crash report:
------------[ cut here ]------------
kernel BUG at fs/bcachefs/lru.h:19!
Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN NOPTI
CPU: 0 UID: 0 PID: 5085 Comm: syz-executor267 Not tainted 6.11.0-rc3-syzkaller-00066-g1fb918967b56 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
RIP: 0010:lru_pos fs/bcachefs/lru.h:19 [inline]
RIP: 0010:__bch2_lru_set fs/bcachefs/lru.c:48 [inline]
RIP: 0010:bch2_lru_del fs/bcachefs/lru.c:54 [inline]
RIP: 0010:bch2_lru_change+0x65c/0x680 fs/bcachefs/lru.c:69
Code: 80 e1 07 38 c1 0f 8c 47 fd ff ff be 14 00 00 00 48 8b 7c 24 10 e8 14 d9 c2 fd e9 33 fd ff ff e8 3a 62 7e 07 e8 65 92 5b fd 90 <0f> 0b e8 5d 92 5b fd 90 0f 0b e8 55 92 5b fd 90 0f 0b e8 4d 92 5b
RSP: 0018:ffffc9000aece6e0 EFLAGS: 00010293
RAX: ffffffff8437f70b RBX: 1ffff920015d9cf2 RCX: ffff8880001fc880
RDX: 0000000000000000 RSI: 0100000001000000 RDI: 0000ffffffffffff
RBP: ffffc9000aece810 R08: ffffffff8437f253 R09: ffffffff8404216f
R10: 0000000000000003 R11: ffff8880001fc880 R12: 0000ffffffffffff
R13: 1ffff920015d9ce4 R14: 0100000001000000 R15: ffff000001000000
FS:  0000555576dd6380(0000) GS:ffff888020800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f6d9100bd97 CR3: 00000000122b8000 CR4: 0000000000350ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 bch2_trigger_alloc+0x1745/0x3f80 fs/bcachefs/alloc_background.c:877
 bch2_key_trigger fs/bcachefs/bkey_methods.h:88 [inline]
 run_one_trans_trigger fs/bcachefs/btree_trans_commit.c:507 [inline]
 run_btree_triggers+0xc91/0x1270 fs/bcachefs/btree_trans_commit.c:540
 bch2_trans_commit_run_triggers fs/bcachefs/btree_trans_commit.c:583 [inline]
 __bch2_trans_commit+0x542/0x9030 fs/bcachefs/btree_trans_commit.c:1058
 bch2_trans_commit fs/bcachefs/btree_update.h:184 [inline]
 bch2_extent_update+0x4c0/0xbb0 fs/bcachefs/io_write.c:325
 bch2_fpunch_at+0x87c/0x1020 fs/bcachefs/io_misc.c:184
 bch2_fpunch+0x412/0x690 fs/bcachefs/io_misc.c:203
 bchfs_fpunch+0x282/0x7a0 fs/bcachefs/fs-io.c:538
 bch2_fallocate_dispatch+0x3e7/0x540 fs/bcachefs/fs-io.c:792
 vfs_fallocate+0x553/0x6c0 fs/open.c:334
 do_vfs_ioctl+0x2592/0x2e50 fs/ioctl.c:886
 __do_sys_ioctl fs/ioctl.c:905 [inline]
 __se_sys_ioctl+0x81/0x170 fs/ioctl.c:893
 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:0x7fad0bc1ab99
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 17 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc8d92bed8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0031656c69662f2e RCX: 00007fad0bc1ab99
RDX: 0000000020000180 RSI: 0000000040305829 RDI: 0000000000000004
RBP: 00007fad0bc935f0 R08: 0000555576dd74c0 R09: 0000555576dd74c0
R10: 0000555576dd74c0 R11: 0000000000000246 R12: 00007ffc8d92bf00
R13: 00007ffc8d92c128 R14: 431bde82d7b634db R15: 00007fad0bc6303b
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:lru_pos fs/bcachefs/lru.h:19 [inline]
RIP: 0010:__bch2_lru_set fs/bcachefs/lru.c:48 [inline]
RIP: 0010:bch2_lru_del fs/bcachefs/lru.c:54 [inline]
RIP: 0010:bch2_lru_change+0x65c/0x680 fs/bcachefs/lru.c:69
Code: 80 e1 07 38 c1 0f 8c 47 fd ff ff be 14 00 00 00 48 8b 7c 24 10 e8 14 d9 c2 fd e9 33 fd ff ff e8 3a 62 7e 07 e8 65 92 5b fd 90 <0f> 0b e8 5d 92 5b fd 90 0f 0b e8 55 92 5b fd 90 0f 0b e8 4d 92 5b
RSP: 0018:ffffc9000aece6e0 EFLAGS: 00010293
RAX: ffffffff8437f70b RBX: 1ffff920015d9cf2 RCX: ffff8880001fc880
RDX: 0000000000000000 RSI: 0100000001000000 RDI: 0000ffffffffffff
RBP: ffffc9000aece810 R08: ffffffff8437f253 R09: ffffffff8404216f
R10: 0000000000000003 R11: ffff8880001fc880 R12: 0000ffffffffffff
R13: 1ffff920015d9ce4 R14: 0100000001000000 R15: ffff000001000000
FS:  0000555576dd6380(0000) GS:ffff888020800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffab111bad5 CR3: 00000000122b8000 CR4: 0000000000350ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400