BTRFS info (device loop1 state EA): forced readonly
assertion failed: folio_test_locked(folio), in fs/btrfs/subpage.c:871
------------[ cut here ]------------
kernel BUG at fs/btrfs/subpage.c:871!
Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
CPU: 0 UID: 0 PID: 64 Comm: kworker/u8:5 Not tainted 6.10.0-syzkaller-12562-g1722389b0d86 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024
Workqueue: writeback wb_workfn
 (flush-btrfs-35)

RIP: 0010:btrfs_folio_end_all_writers+0x55b/0x610 fs/btrfs/subpage.c:871
Code: e9 d3 fb ff ff e8 65 25 c1 fd 48 c7 c7 80 41 2e 8c 48 c7 c6 40 42 2e 8c 48 c7 c2 20 41 2e 8c b9 67 03 00 00 e8 96 27 d7 07 90 <0f> 0b e8 ee 26 da 07 4c 89 ff be 08 00 00 00 e8 b1 3c 25 fe 4c 89
RSP: 0018:ffffc900015f6cc0 EFLAGS: 00010246

RAX: 0000000000000045 RBX: 00fff0000000402c RCX: 0f3ed3cb79a40500
RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000
RBP: ffffc900015f6d90 R08: ffffffff8173e03c R09: 1ffff920002bed38
R10: dffffc0000000000 R11: fffff520002bed39 R12: 0000000000000001
R13: dffffc0000000000 R14: 0000000000000000 R15: ffffea0001637d40
FS:  0000000000000000(0000) GS:ffff8880b9200000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffaf96c5270 CR3: 00000000572b0000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 __extent_writepage fs/btrfs/extent_io.c:1597 [inline]
 extent_write_cache_pages fs/btrfs/extent_io.c:2251 [inline]
 btrfs_writepages+0x14d7/0x2760 fs/btrfs/extent_io.c:2373
 do_writepages+0x35d/0x870 mm/page-writeback.c:2683
 __writeback_single_inode+0x165/0x10b0 fs/fs-writeback.c:1651
 writeback_sb_inodes+0x99c/0x1380 fs/fs-writeback.c:1947
 wb_writeback+0x481/0xd40 fs/fs-writeback.c:2127
 wb_do_writeback fs/fs-writeback.c:2274 [inline]
 wb_workfn+0x410/0x1090 fs/fs-writeback.c:2314
 process_one_work kernel/workqueue.c:3231 [inline]
 process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3312
 worker_thread+0x86d/0xd40 kernel/workqueue.c:3390
 kthread+0x2f0/0x390 kernel/kthread.c:389
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:btrfs_folio_end_all_writers+0x55b/0x610 fs/btrfs/subpage.c:871
Code: e9 d3 fb ff ff e8 65 25 c1 fd 48 c7 c7 80 41 2e 8c 48 c7 c6 40 42 2e 8c 48 c7 c2 20 41 2e 8c b9 67 03 00 00 e8 96 27 d7 07 90 <0f> 0b e8 ee 26 da 07 4c 89 ff be 08 00 00 00 e8 b1 3c 25 fe 4c 89
RSP: 0018:ffffc900015f6cc0 EFLAGS: 00010246
RAX: 0000000000000045 RBX: 00fff0000000402c RCX: 0f3ed3cb79a40500
RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000
RBP: ffffc900015f6d90 R08: ffffffff8173e03c R09: 1ffff920002bed38
R10: dffffc0000000000 R11: fffff520002bed39 R12: 0000000000000001
R13: dffffc0000000000 R14: 0000000000000000 R15: ffffea0001637d40
FS:  0000000000000000(0000) GS:ffff8880b9200000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffc531f90f8 CR3: 000000007de0a000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400