loop0: detected capacity change from 0 to 32768 bcachefs (loop0): starting version 1.7: mi_btree_bitmap opts=errors=continue,metadata_checksum=none,data_checksum=none,compression=lz4,str_hash=crc32c,journal_flush_disabled,norecovery,nojournal_transaction_names,reconstruct_alloc bcachefs (loop0): recovering from clean shutdown, journal seq 10 bcachefs (loop0): Version upgrade required: Version upgrade from 0.24: unwritten_extents to 1.7: mi_btree_bitmap incomplete Doing incompatible version upgrade from 0.24: unwritten_extents to 1.25: extent_flags running recovery passes: check_allocations,check_alloc_info,check_lrus,check_btree_backpointers,check_backpointers_to_extents,check_extents_to_backpointers,check_alloc_to_lru_refs,bucket_gens_init,check_snapshot_trees,check_snapshots,check_subvols,check_subvol_children,delete_dead_snapshots,check_inodes,check_extents,check_indirect_extents,check_dirents,check_xattrs,check_root,check_unreachable_inodes,check_subvolume_structure,check_directory_structure,check_nlinks,set_fs_needs_rebalance bcachefs (loop0): dropping and reconstructing all alloc info bcachefs (loop0): running explicit recovery pass check_topology (2), currently at recovery_pass_empty (0) bcachefs (loop0): bcachefs (loop0): error validating btree node on loop0 at btree xattrs level 0/0 u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq 2285c34bed0abe32 written 16 min_key POS_MIN durability: 1 ptr: 0:31:0 gen 0 node offset 0/16: incorrect min_key: got 0:0:458752 should be POS_MIN, btree topology error: bcachefs (loop0): flagging btree xattrs lost data bcachefs (loop0): running explicit recovery pass scan_for_btree_nodes (1), currently at recovery_pass_empty (0) bcachefs (loop0): error reading btree root btree=xattrs level=0: btree_node_read_error, fixing bcachefs (loop0): scan_for_btree_nodes... bcachefs (loop0): btree node scan found 7 nodes after overwrites done bcachefs (loop0): check_topology... bcachefs (loop0): btree root xattrs unreadable, must recover from scan bcachefs (loop0): bch2_get_scanned_nodes(): recovery btree=xattrs level=0 POS_MIN - SPOS_MAX bcachefs (loop0): bch2_get_scanned_nodes(): recovering u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq 2285c34bed0abe32 written 16 min_key 0:0:458752 durability: 1 ptr: 0:31:0 gen 0 bcachefs (loop0): bch2_get_scanned_nodes(): recovery btree=xattrs level=0 POS_MIN - 0:0:458751 bcachefs (loop0): btree node with incorrect min_key at btree=xattrs level=1: parent: u64s 5 type btree_ptr SPOS_MAX len 0 ver 0 next: u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq 2285c34bed0abe32 written 16 min_key 0:0:458752 durability: 1 ptr: 0:31:0 gen 0, fixing bcachefs (loop0): set_node_min(): u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq 2285c34bed0abe32 written 16 min_key 0:0:458752 durability: 1 ptr: 0:31:0 gen 0 -> POS_MIN done bcachefs (loop0): accounting_read... done bcachefs (loop0): alloc_read... done bcachefs (loop0): snapshots_read... done bcachefs (loop0): Fixed errors, running fsck a second time to verify fs is clean bcachefs (loop0): done starting filesystem bcachefs (loop0): btree_path_down(): fatal error node not found at pos 536870913:5159715431275259989:U32_MAX within parent node u64s 5 type btree_ptr SPOS_MAX len 0 ver 0 bcachefs (loop0): fatal error - emergency read only BUG: sleeping function called from invalid context at ./include/linux/sched/mm.h:321 in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 5323, name: syz.0.0 preempt_count: 0, expected: 0 RCU nest depth: 1, expected: 0 5 locks held by syz.0.0/5323: #0: ffff8880442e46c8 (&ima_iint_mutex_key[depth]){+.+.}-{4:4}, at: process_measurement+0x7d6/0x1fe0 security/integrity/ima/ima_main.c:277 #1: ffff8880554b4a80 (mapping.invalidate_lock#3){.+.+}-{4:4}, at: filemap_invalidate_lock_shared include/linux/fs.h:922 [inline] #1: ffff8880554b4a80 (mapping.invalidate_lock#3){.+.+}-{4:4}, at: page_cache_ra_order+0x45e/0xca0 mm/readahead.c:491 #2: ffff888054904210 (&c->btree_trans_barrier){.+.+}-{0:0}, at: srcu_lock_acquire include/linux/srcu.h:161 [inline] #2: ffff888054904210 (&c->btree_trans_barrier){.+.+}-{0:0}, at: srcu_read_lock include/linux/srcu.h:253 [inline] #2: ffff888054904210 (&c->btree_trans_barrier){.+.+}-{0:0}, at: __bch2_trans_get+0x7ed/0xd40 fs/bcachefs/btree_iter.c:3386 #3: ffff8880535f8140 (bcachefs_btree){+.+.}-{0:0}, at: trans_set_locked fs/bcachefs/btree_locking.h:198 [inline] #3: ffff8880535f8140 (bcachefs_btree){+.+.}-{0:0}, at: __bch2_trans_relock+0x386/0x600 fs/bcachefs/btree_locking.c:786 #4: ffffffff8ed3b560 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:331 [inline] #4: ffffffff8ed3b560 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:841 [inline] #4: ffffffff8ed3b560 (rcu_read_lock){....}-{1:3}, at: bch2_bkey_pick_read_device+0x29c/0x19b0 fs/bcachefs/extents.c:144 CPU: 0 UID: 0 PID: 5323 Comm: syz.0.0 Not tainted 6.14.0-syzkaller-11270-g08733088b566 #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 __might_resched+0x558/0x6c0 kernel/sched/core.c:8818 might_alloc include/linux/sched/mm.h:321 [inline] slab_pre_alloc_hook mm/slub.c:4089 [inline] slab_alloc_node mm/slub.c:4167 [inline] __do_kmalloc_node mm/slub.c:4317 [inline] __kmalloc_node_track_caller_noprof+0xd3/0x4d0 mm/slub.c:4337 __do_krealloc mm/slub.c:4895 [inline] krealloc_noprof+0x10f/0x300 mm/slub.c:4948 bch2_printbuf_make_room+0x1f1/0x350 fs/bcachefs/printbuf.c:59 bch2_prt_printf+0x269/0x6d0 fs/bcachefs/printbuf.c:186 bch2_log_msg_start fs/bcachefs/error.c:19 [inline] bch2_fs_trans_inconsistent fs/bcachefs/error.c:63 [inline] bch2_fs_inconsistent+0x143/0x220 fs/bcachefs/error.c:81 bch2_dev_rcu fs/bcachefs/sb-members.h:226 [inline] bch2_bkey_pick_read_device+0x95e/0x19b0 fs/bcachefs/extents.c:165 __bch2_read_extent+0x3ab/0x4400 fs/bcachefs/io_read.c:963 bch2_read_extent fs/bcachefs/io_read.h:140 [inline] bchfs_read+0x251a/0x3350 fs/bcachefs/fs-io-buffered.c:226 bch2_readahead+0xe7a/0x12d0 fs/bcachefs/fs-io-buffered.c:301 read_pages+0x193/0x590 mm/readahead.c:160 page_cache_ra_order+0xa37/0xca0 mm/readahead.c:515 filemap_get_pages+0x59f/0x1fc0 mm/filemap.c:2602 filemap_read+0x466/0x1260 mm/filemap.c:2713 bch2_read_iter+0x1179/0x14b0 fs/bcachefs/fs-io-direct.c:221 __kernel_read+0x532/0xa10 fs/read_write.c:528 integrity_kernel_read+0xb2/0x100 security/integrity/iint.c:28 ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:480 [inline] ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline] ima_calc_file_hash+0xb22/0x1c10 security/integrity/ima/ima_crypto.c:568 ima_collect_measurement+0x52b/0xb20 security/integrity/ima/ima_api.c:293 process_measurement+0x13a3/0x1fe0 security/integrity/ima/ima_main.c:383 ima_file_check+0xdb/0x130 security/integrity/ima/ima_main.c:611 security_file_post_open+0xb9/0x280 security/security.c:3130 do_open fs/namei.c:3847 [inline] path_openat+0x2cf7/0x35d0 fs/namei.c:4004 do_filp_open+0x284/0x4e0 fs/namei.c:4031 do_sys_openat2+0x12b/0x1d0 fs/open.c:1429 do_sys_open fs/open.c:1444 [inline] __do_sys_openat fs/open.c:1460 [inline] __se_sys_openat fs/open.c:1455 [inline] __x64_sys_openat+0x249/0x2a0 fs/open.c:1455 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f6063f8d169 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:00007f6064d55038 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007f60641a5fa0 RCX: 00007f6063f8d169 RDX: 0000000000101442 RSI: 0000200000000080 RDI: ffffffffffffff9c RBP: 00007f606400e2a0 R08: 0000000000000000 R09: 0000000000000000 R10: 00000000000001ff R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f60641a5fa0 R15: 00007ffc51e6db68 bcachefs (loop0): pointer to nonexistent device 237 bcachefs (loop0): /file3 offset 0: no_devices_valid u64s 7 type extent 536870913:24:U32_MAX len 24 ver 0: durability: 0 crc: c_size 8 size 24 offset 0 nonce 0 csum none 0:0 compress lz4 ptr: 237:893353206280 gen 0 bcachefs (loop0): pointer to nonexistent device 237 bcachefs (loop0): /file3 offset 0: no_devices_valid u64s 7 type extent 536870913:24:U32_MAX len 24 ver 0: durability: 0 crc: c_size 8 size 24 offset 0 nonce 0 csum none 0:0 compress lz4 ptr: 237:893353206280 gen 0 bcachefs (loop0): btree_path_down(): fatal error node not found at pos 536870913:5159715431275259989:U32_MAX within parent node u64s 5 type btree_ptr SPOS_MAX len 0 ver 0 bcachefs (loop0): pointer to nonexistent device 237 bcachefs (loop0): /file3 offset 0: no_devices_valid u64s 7 type extent 536870913:24:U32_MAX len 24 ver 0: durability: 0 crc: c_size 8 size 24 offset 0 nonce 0 csum none 0:0 compress lz4 ptr: 237:893353206280 gen 0 bcachefs (loop0): btree_path_down(): fatal error node not found at pos 536870913:2741597938742309223:U32_MAX within parent node u64s 5 type btree_ptr SPOS_MAX len 0 ver 0 bcachefs (loop0): btree_path_down(): fatal error node not found at pos 4098:6938188414672228844:U32_MAX within parent node u64s 5 type btree_ptr SPOS_MAX len 0 ver 0