assertion failed: !(ticket->bytes == 0 && ticket->error) :: 0, in fs/btrfs/space-info.c:1672
------------[ cut here ]------------
kernel BUG at fs/btrfs/space-info.c:1672!
Oops: invalid opcode: 0000 [#1] SMP KASAN PTI
CPU: 1 UID: 0 PID: 6276 Comm: syz.0.86 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025
RIP: 0010:handle_reserve_ticket fs/btrfs/space-info.c:1672 [inline]
RIP: 0010:reserve_bytes+0x129e/0x1410 fs/btrfs/space-info.c:1865
Code: 0f 0b e8 45 dd ca fd 48 c7 c7 00 d5 b0 8b 48 c7 c6 20 e1 b0 8b 31 d2 48 c7 c1 e0 d1 b0 8b 41 b8 88 06 00 00 e8 e3 ee 30 fd 90 <0f> 0b f3 0f 1e fa 65 8b 1d a9 0e 7f 0e bf 07 00 00 00 89 de e8 49
RSP: 0018:ffffc9000beb76c0 EFLAGS: 00010246
RAX: 000000000000005c RBX: 0000000000000000 RCX: a6ec7619d16de400
RDX: ffffc90004ae2000 RSI: 000000000007ffff RDI: 0000000000080000
RBP: ffffc9000beb78f0 R08: ffffc9000beb73e7 R09: 1ffff920017d6e7c
R10: dffffc0000000000 R11: fffff520017d6e7d R12: ffff8880302a6000
R13: dffffc0000000000 R14: 00000000fffffffc R15: ffffc9000beb7760
FS: 00007fa936d776c0(0000) GS:ffff888125fc5000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f754e71deac CR3: 0000000031228000 CR4: 00000000003526f0
Call Trace:
<TASK>
btrfs_reserve_metadata_bytes+0x28/0x150 fs/btrfs/space-info.c:1888
btrfs_delalloc_reserve_metadata+0x3cb/0x6e0 fs/btrfs/delalloc-space.c:361
reserve_space fs/btrfs/file.c:1150 [inline]
copy_one_range fs/btrfs/file.c:1225 [inline]
btrfs_buffered_write+0x56a/0x15f0 fs/btrfs/file.c:1387
btrfs_do_write_iter+0x2fc/0x820 fs/btrfs/file.c:1463
new_sync_write fs/read_write.c:593 [inline]
vfs_write+0x5c9/0xb30 fs/read_write.c:686
ksys_write+0x145/0x250 fs/read_write.c:738
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xfa/0xfa0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fa935f8f6c9
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:00007fa936d77038 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007fa9361e5fa0 RCX: 00007fa935f8f6c9
RDX: 000000000208e24b RSI: 0000200000000040 RDI: 0000000000000004
RBP: 00007fa936011f91 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fa9361e6038 R14: 00007fa9361e5fa0 R15: 00007fff95fa1a78
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:handle_reserve_ticket fs/btrfs/space-info.c:1672 [inline]
RIP: 0010:reserve_bytes+0x129e/0x1410 fs/btrfs/space-info.c:1865
Code: 0f 0b e8 45 dd ca fd 48 c7 c7 00 d5 b0 8b 48 c7 c6 20 e1 b0 8b 31 d2 48 c7 c1 e0 d1 b0 8b 41 b8 88 06 00 00 e8 e3 ee 30 fd 90 <0f> 0b f3 0f 1e fa 65 8b 1d a9 0e 7f 0e bf 07 00 00 00 89 de e8 49
RSP: 0018:ffffc9000beb76c0 EFLAGS: 00010246
RAX: 000000000000005c RBX: 0000000000000000 RCX: a6ec7619d16de400
RDX: ffffc90004ae2000 RSI: 000000000007ffff RDI: 0000000000080000
RBP: ffffc9000beb78f0 R08: ffffc9000beb73e7 R09: 1ffff920017d6e7c
R10: dffffc0000000000 R11: fffff520017d6e7d R12: ffff8880302a6000
R13: dffffc0000000000 R14: 00000000fffffffc R15: ffffc9000beb7760
FS: 00007fa936d776c0(0000) GS:ffff888125fc5000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f754e71deac CR3: 0000000031228000 CR4: 00000000003526f0