------------[ cut here ]------------ truncate spotted in mem i_size < btree i_size: 3 < 1048576 WARNING: CPU: 0 PID: 20632 at fs/bcachefs/fs-io.c:471 bchfs_truncate+0x824/0xe80 fs/bcachefs/fs-io.c:471 Modules linked in: CPU: 0 UID: 0 PID: 20632 Comm: syz.6.3811 Not tainted 6.16.0-rc7-syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 RIP: 0010:bchfs_truncate+0x824/0xe80 fs/bcachefs/fs-io.c:471 Code: 24 48 84 c0 0f 85 77 fc ff ff e8 a7 b9 6d fd c6 05 23 85 43 0c 01 90 48 c7 c7 60 66 04 8c 4c 89 f2 4c 89 ee e8 dd c1 2c fd 90 <0f> 0b 90 90 48 b8 00 00 00 00 00 fc ff df 48 8b 54 24 40 48 c1 ea RSP: 0018:ffffc90003e0f6d8 EFLAGS: 00010286 RAX: 0000000000000000 RBX: ffff888077984458 RCX: ffffc9001b1ff000 RDX: 0000000000080000 RSI: ffffffff817af1b5 RDI: 0000000000000001 RBP: ffffc90003e0f920 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000001 R12: ffffc90003e0fa18 R13: 0000000000000003 R14: 0000000000100000 R15: ffff8880779849c0 FS: 00007fbc7f5fe6c0(0000) GS:ffff888124727000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f87d01b6038 CR3: 0000000074cf3000 CR4: 0000000000350ef0 Call Trace: bch2_setattr+0x19c/0x240 fs/bcachefs/fs.c:1241 notify_change+0x6a9/0x1230 fs/attr.c:552 do_truncate+0x1d7/0x230 fs/open.c:68 handle_truncate fs/namei.c:3517 [inline] do_open fs/namei.c:3900 [inline] path_openat+0x2678/0x2cb0 fs/namei.c:4055 do_filp_open+0x20b/0x470 fs/namei.c:4082 do_sys_openat2+0x11b/0x1d0 fs/open.c:1437 do_sys_open fs/open.c:1452 [inline] __do_sys_openat fs/open.c:1468 [inline] __se_sys_openat fs/open.c:1463 [inline] __x64_sys_openat+0x174/0x210 fs/open.c:1463 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fbc7e78e9a9 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:00007fbc7f5fe038 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007fbc7e9b6160 RCX: 00007fbc7e78e9a9 RDX: 0000000000123380 RSI: 00002000000001c0 RDI: ffffffffffffff9c RBP: 00007fbc7e810d69 R08: 0000000000000000 R09: 0000000000000000 R10: 00000000000000d4 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000001 R14: 00007fbc7e9b6160 R15: 00007ffc2d2793d8