------------[ cut here ]------------
WARNING: fs/bcachefs/btree_iter.c:3194 at __bch2_trans_kmalloc+0x50f/0x9d0, CPU#1: kworker/1:4/5891
Modules linked in:
CPU: 1 UID: 0 PID: 5891 Comm: kworker/1:4 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Workqueue: bcachefs_write_ref bch2_do_discards_work
RIP: 0010:__bch2_trans_kmalloc+0x50f/0x9d0
Code: 00 28 00 00 e8 52 81 35 00 48 c7 c0 75 f7 ff ff 48 83 c4 48 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc cc e8 62 c6 94 fd 90 <0f> 0b 90 e9 d3 fb ff ff e8 54 c6 94 fd 90 0f 0b 90 e9 dc fd ff ff
RSP: 0018:ffffc90003b86a50 EFLAGS: 00010293
RAX: ffffffff842ae5ae RBX: ffff88811fad0000 RCX: ffff888107691d00
RDX: 0000000000000000 RSI: 0000000000020000 RDI: 0000000000010000
RBP: 0000000000020000 R08: ffffc90003b86e50 R09: 0000000000000001
R10: ffffc90003b86d60 R11: fffff52000770d79 R12: dffffc0000000000
R13: ffff88811fad0030 R14: 1ffff11023f5a000 R15: 0000000000000011
FS:  0000000000000000(0000) GS:ffff8881a39f1000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007efe379710e8 CR3: 000000010eaa4000 CR4: 00000000000006f0
Call Trace:
 <TASK>
 bch2_alloc_sectors_start_trans+0x1d59/0x1e80
 bch2_btree_reserve_get+0x641/0x1810
 bch2_btree_update_start+0x18ff/0x1de0
 bch2_btree_split_leaf+0x14b/0x8e0
 bch2_trans_commit_error+0x1b7/0x1130
 __bch2_trans_commit+0x1bb5/0x8880
 bch2_discard_one_bucket+0xa32/0x11a0
 bch2_do_discards_work+0x3b3/0x9c0
 process_scheduled_works+0xae1/0x17b0
 worker_thread+0x8a0/0xda0
 kthread+0x711/0x8a0
 ret_from_fork+0x47f/0x820
 ret_from_fork_asm+0x1a/0x30
 </TASK>
