bcachefs (loop0): btree root extents unreadable, must recover from scan
no nodes found for btree extents, continuing
bcachefs (loop0): btree root xattrs unreadable, must recover from scan
no nodes found for btree xattrs, continuing
bcachefs (loop0): btree root deleted_inodes unreadable, must recover from scan
bcachefs (loop0): bch2_get_scanned_nodes(): recovery btree=deleted_inodes level=0 POS_MIN - SPOS_MAX
bcachefs (loop0): bch2_get_scanned_nodes(): recovering u64s 11 type btree_ptr_v2 18446744073693298687:U64_MAX:U32_MAX len 0 ver 0: seq ac62141f8dc7e261 written 24 min_key POS_MIN durability: 1 ptr: 0:26:0 gen 0
bcachefs (loop0): bch2_get_scanned_nodes(): recovering u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq 1db8f60c84bb244c written 8 min_key R 18446744073693298688:0:0 durability: 1 ptr: 0:42:0 gen 0
 done
bcachefs (loop0): accounting_read... done
bcachefs (loop0): alloc_read... done
bcachefs (loop0): stripes_read... done
bcachefs (loop0): snapshots_read... done
bcachefs (loop0): check_allocations... done
bcachefs (loop0): going read-write
bcachefs (loop0): journal_replay... done
bcachefs (loop0): check_alloc_info... done
bcachefs (loop0): check_lrus... done
bcachefs (loop0): check_btree_backpointers... done
bcachefs (loop0): check_backpointers_to_extents... done
bcachefs (loop0): check_extents_to_backpointers...
bcachefs (loop0): scanning for missing backpointers in 5/128 buckets
 done
bcachefs (loop0): check_alloc_to_lru_refs... done
bcachefs (loop0): bucket_gens_init... done
bcachefs (loop0): check_snapshot_trees... done
bcachefs (loop0): check_snapshots...
snapshot points to missing/incorrect tree:
  u64s 8 type snapshot 0:4294967295:0 len 0 ver 0: is_subvol 1 deleted 0 parent          0 children          0          0 subvol 1 tree 0, fixing
snapshot points to missing/incorrect tree:
  u64s 8 type snapshot 0:4294967295:0 len 0 ver 0: is_subvol 1 deleted 0 parent          0 children          0          0 subvol 1 tree 0, fixing
 done
bcachefs (loop0): check_subvols... done
bcachefs (loop0): check_subvol_children... done
bcachefs (loop0): delete_dead_snapshots... done
bcachefs (loop0): check_inodes... done
bcachefs (loop0): check_extents... done
bcachefs (loop0): check_indirect_extents... done
bcachefs (loop0): check_dirents... done
bcachefs (loop0): check_xattrs... done
bcachefs (loop0): check_root... done
bcachefs (loop0): check_unreachable_inodes... done
bcachefs (loop0): check_subvolume_structure... done
bcachefs (loop0): check_directory_structure... done
bcachefs (loop0): check_nlinks...
inode 536870914 type reg has wrong i_nlink (2780562353, should be 1), fixing
 done
bcachefs (loop0): resume_logged_ops... done
bcachefs (loop0): delete_dead_inodes...
------------[ cut here ]------------
kernel BUG at fs/bcachefs/btree_iter.c:268!
Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN NOPTI
CPU: 0 UID: 0 PID: 5320 Comm: syz.0.0 Not tainted 6.14.0-rc2-syzkaller-00303-gad1b832bf1cf #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
RIP: 0010:bch2_btree_iter_verify_entry_exit+0xb20/0xb60 fs/bcachefs/btree_iter.c:267
Code: 51 fa ff ff 44 89 f1 80 e1 07 38 c1 0f 8c 56 fa ff ff be 08 00 00 00 4c 89 f7 e8 db 17 dc fd e9 44 fa ff ff e8 11 d6 74 fd 90 <0f> 0b e8 09 d6 74 fd 90 0f 0b e8 01 d6 74 fd 90 0f 0b e8 f9 d5 74
RSP: 0018:ffffc9000d3d6b18 EFLAGS: 00010246
RAX: ffffffff844ce22f RBX: 0000000000000000 RCX: 0000000000100000
RDX: ffffc9000e3ba000 RSI: 00000000000fffff RDI: 0000000000100000
RBP: dffffc0000000000 R08: ffffffff844cd798 R09: 0000000000000000
R10: ffffc9000d3d6960 R11: fffff52001a7ad31 R12: 0000000000000820
R13: dffffc0000000000 R14: ffffc9000d3d7080 R15: ffffc9000d3d7080
FS:  00007ff4e723f6c0(0000) GS:ffff88801fc00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000559ec26d6028 CR3: 00000000363f6000 CR4: 0000000000352ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 bch2_btree_iter_peek_slot+0x18d/0x27c0 fs/bcachefs/btree_iter.c:2761
 __bch2_bkey_get_iter fs/bcachefs/btree_iter.h:585 [inline]
 bch2_bkey_get_iter fs/bcachefs/btree_iter.h:599 [inline]
 may_delete_deleted_inode fs/bcachefs/inode.c:1334 [inline]
 bch2_delete_dead_inodes+0x9d6/0x23c0 fs/bcachefs/inode.c:1434
 bch2_run_recovery_pass+0xf0/0x1e0 fs/bcachefs/recovery_passes.c:226
 bch2_run_recovery_passes+0x2ad/0xa90 fs/bcachefs/recovery_passes.c:291
 bch2_fs_recovery+0x265a/0x3de0 fs/bcachefs/recovery.c:936
 bch2_fs_start+0x37c/0x610 fs/bcachefs/super.c:1041
 bch2_fs_get_tree+0xdb7/0x17a0 fs/bcachefs/fs.c:2203
 vfs_get_tree+0x90/0x2b0 fs/super.c:1814
 do_new_mount+0x2be/0xb40 fs/namespace.c:3560
 do_mount fs/namespace.c:3900 [inline]
 __do_sys_mount fs/namespace.c:4111 [inline]
 __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:4088
 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:0x7ff4e638e58a
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 1a 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 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:00007ff4e723ee68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ff4e723eef0 RCX: 00007ff4e638e58a
RDX: 00004000000000c0 RSI: 0000400000000000 RDI: 00007ff4e723eeb0
RBP: 00004000000000c0 R08: 00007ff4e723eef0 R09: 0000000001000000
R10: 0000000001000000 R11: 0000000000000246 R12: 0000400000000000
R13: 00007ff4e723eeb0 R14: 00000000000059be R15: 0000400000005b80
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:bch2_btree_iter_verify_entry_exit+0xb20/0xb60 fs/bcachefs/btree_iter.c:267
Code: 51 fa ff ff 44 89 f1 80 e1 07 38 c1 0f 8c 56 fa ff ff be 08 00 00 00 4c 89 f7 e8 db 17 dc fd e9 44 fa ff ff e8 11 d6 74 fd 90 <0f> 0b e8 09 d6 74 fd 90 0f 0b e8 01 d6 74 fd 90 0f 0b e8 f9 d5 74
RSP: 0018:ffffc9000d3d6b18 EFLAGS: 00010246
RAX: ffffffff844ce22f RBX: 0000000000000000 RCX: 0000000000100000
RDX: ffffc9000e3ba000 RSI: 00000000000fffff RDI: 0000000000100000
RBP: dffffc0000000000 R08: ffffffff844cd798 R09: 0000000000000000
R10: ffffc9000d3d6960 R11: fffff52001a7ad31 R12: 0000000000000820
R13: dffffc0000000000 R14: ffffc9000d3d7080 R15: ffffc9000d3d7080
FS:  00007ff4e723f6c0(0000) GS:ffff88801fc00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000559ec26d6028 CR3: 00000000363f6000 CR4: 0000000000352ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400