syz.2.186: attempt to access beyond end of device loop2: rw=2049, sector=10504, nr_sectors = 96 limit=0 assertion failed: folio->mapping, in fs/btrfs/ordered-data.c:344 ------------[ cut here ]------------ kernel BUG at fs/btrfs/ordered-data.c:344! Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI CPU: 1 UID: 0 PID: 6609 Comm: syz.2.186 Not tainted 6.11.0-rc4-next-20240822-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 RIP: 0010:can_finish_ordered_extent+0x754/0x9e0 fs/btrfs/ordered-data.c:344 Code: e9 67 fe ff ff e8 2c 0c db fd 48 c7 c7 80 d0 4c 8c 48 c7 c6 e0 d6 4c 8c 48 c7 c2 40 d0 4c 8c b9 58 01 00 00 e8 0d 48 03 08 90 <0f> 0b e8 05 0c db fd 48 c7 c7 80 d0 4c 8c 48 c7 c6 00 d7 4c 8c 48 RSP: 0018:ffffc900042e6910 EFLAGS: 00010046 RAX: 0000000000000040 RBX: dffffc0000000000 RCX: cb9d96b8e030f400 RDX: ffffc90010b64000 RSI: 000000000002db53 RDI: 000000000002db54 RBP: ffffea00015bbe58 R08: ffffffff8174567c R09: 1ffff9200085ccbc R10: dffffc0000000000 R11: fffff5200085ccbd R12: ffff8880629822a0 R13: 0000000000000000 R14: ffff8880629822a0 R15: ffffea00015bbe40 FS: 00007f1f8df9e6c0(0000) GS:ffff8880b9100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f9fd8d2afe4 CR3: 0000000078844000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: btrfs_finish_ordered_extent+0x140/0x480 fs/btrfs/ordered-data.c:410 end_bbio_data_write+0x4bd/0x750 fs/btrfs/extent_io.c:476 __btrfs_bio_end_io fs/btrfs/bio.c:116 [inline] btrfs_orig_bbio_end_io+0x3ba/0x470 fs/btrfs/bio.c:162 btrfs_submit_chunk fs/btrfs/bio.c:756 [inline] btrfs_submit_bio+0x11fc/0x1940 fs/btrfs/bio.c:775 submit_one_bio+0x115/0x1c0 fs/btrfs/extent_io.c:120 submit_extent_folio+0xad3/0xe90 submit_one_sector fs/btrfs/extent_io.c:1315 [inline] __extent_writepage_io+0x84e/0xc90 fs/btrfs/extent_io.c:1391 __extent_writepage fs/btrfs/extent_io.c:1457 [inline] extent_write_cache_pages fs/btrfs/extent_io.c:2125 [inline] btrfs_writepages+0x1132/0x22a0 fs/btrfs/extent_io.c:2251 do_writepages+0x35d/0x870 mm/page-writeback.c:2683 filemap_fdatawrite_wbc+0x125/0x180 mm/filemap.c:398 __filemap_fdatawrite_range mm/filemap.c:431 [inline] filemap_fdatawrite_range+0x11a/0x180 mm/filemap.c:449 btrfs_fdatawrite_range fs/btrfs/file.c:3778 [inline] start_ordered_ops fs/btrfs/file.c:1546 [inline] btrfs_sync_file+0x31d/0x10f0 fs/btrfs/file.c:1623 generic_write_sync include/linux/fs.h:2850 [inline] btrfs_do_write_iter+0x5e2/0x760 fs/btrfs/file.c:1498 do_iter_readv_writev+0x602/0x880 vfs_writev+0x37c/0xbb0 fs/read_write.c:971 do_pwritev fs/read_write.c:1072 [inline] __do_sys_pwritev2 fs/read_write.c:1131 [inline] __se_sys_pwritev2+0x1ca/0x2d0 fs/read_write.c:1122 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:0x7f1f8d179e79 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:00007f1f8df9e038 EFLAGS: 00000246 ORIG_RAX: 0000000000000148 RAX: ffffffffffffffda RBX: 00007f1f8d315f80 RCX: 00007f1f8d179e79 RDX: 0000000000000001 RSI: 0000000020000100 RDI: 0000000000000006 RBP: 00007f1f8d1e7916 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000005412 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f1f8d315f80 R15: 00007ffedbd97208 Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:can_finish_ordered_extent+0x754/0x9e0 fs/btrfs/ordered-data.c:344 Code: e9 67 fe ff ff e8 2c 0c db fd 48 c7 c7 80 d0 4c 8c 48 c7 c6 e0 d6 4c 8c 48 c7 c2 40 d0 4c 8c b9 58 01 00 00 e8 0d 48 03 08 90 <0f> 0b e8 05 0c db fd 48 c7 c7 80 d0 4c 8c 48 c7 c6 00 d7 4c 8c 48 RSP: 0018:ffffc900042e6910 EFLAGS: 00010046 RAX: 0000000000000040 RBX: dffffc0000000000 RCX: cb9d96b8e030f400 RDX: ffffc90010b64000 RSI: 000000000002db53 RDI: 000000000002db54 RBP: ffffea00015bbe58 R08: ffffffff8174567c R09: 1ffff9200085ccbc R10: dffffc0000000000 R11: fffff5200085ccbd R12: ffff8880629822a0 R13: 0000000000000000 R14: ffff8880629822a0 R15: ffffea00015bbe40 FS: 00007f1f8df9e6c0(0000) GS:ffff8880b9100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f9fd8d2afe4 CR3: 0000000078844000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400