bcachefs (loop0): check_topology... bcachefs (loop0): btree root xattrs unreadable, must recover from scan no nodes found for btree xattrs, continuing bcachefs (loop0): btree root subvolumes unreadable, must recover from scan bcachefs (loop0): bch2_get_scanned_nodes(): recovering subvolumes l=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 c0bef60d07ceb940 written 16 min_key POS_MIN durability: 1 ptr: 0:35: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... bucket 0:26 data type btree ptr gen 0 missing in alloc btree while marking u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq ac62141f8dc7e261 written 24 min_key POS_MIN durability: 1 ptr: 0:26:0 gen 0, fixing bucket 0:38 data type btree ptr gen 0 missing in alloc btree while marking u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq 7589ab5e0c11cc7a written 24 min_key POS_MIN durability: 1 ptr: 0:38:0 gen 0, fixing bucket 0:41 data type btree ptr gen 0 missing in alloc btree while marking u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq 9aa2895aefce4bdf written 24 min_key POS_MIN durability: 1 ptr: 0:41:0 gen 0, fixing bucket 0:35 data type btree ptr gen 0 missing in alloc btree while marking u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq c0bef60d07ceb940 written 16 min_key POS_MIN durability: 1 ptr: 0:35:0 gen 0, fixing bucket 0:28 data type btree ptr gen 0 missing in alloc btree while marking u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq 28f61e078e70b95c written 16 min_key POS_MIN durability: 1 ptr: 0:28:0 gen 0, fixing bucket 0:1 gen 0 has wrong data_type: got free, should be sb, fixing bucket 0:1 gen 0 data type sb has wrong dirty_sectors: got 0, should be 256, fixing bucket 0:2 gen 0 has wrong data_type: got free, should be sb, fixing bucket 0:2 gen 0 data type sb has wrong dirty_sectors: got 0, should be 256, fixing bucket 0:3 gen 0 has wrong data_type: got free, should be sb, fixing bucket 0:3 gen 0 data type sb has wrong dirty_sectors: got 0, should be 256, fixing bucket 0:4 gen 0 has wrong data_type: got free, should be sb, fixing bucket 0:4 gen 0 data type sb has wrong dirty_sectors: got 0, should be 256, fixing bucket 0:5 gen 0 has wrong data_type: got free, should be sb, fixing bucket 0:5 gen 0 data type sb has wrong dirty_sectors: got 0, should be 256, fixing bucket 0:6 gen 0 has wrong data_type: got free, should be sb, fixing bucket 0:6 gen 0 data type sb has wrong dirty_sectors: got 0, should be 256, fixing bucket 0:7 gen 0 has wrong data_type: got free, should be sb, fixing bucket 0:7 gen 0 data type sb has wrong dirty_sectors: got 0, should be 256, fixing bucket 0:8 gen 0 has wrong data_type: got free, should be sb, fixing bucket 0:8 gen 0 data type sb has wrong dirty_sectors: got 0, should be 8, fixing bucket 0:9 gen 0 has wrong data_type: got free, should be journal, fixing bucket 0:9 gen 0 data type journal has wrong dirty_sectors: got 0, should be 256, fixing bucket 0:10 gen 0 has wrong data_type: got free, should be journal, fixing bucket 0:10 gen 0 data type journal has wrong dirty_sectors: got 0, should be 256, fixing bucket 0:11 gen 0 has wrong data_type: got free, should be journal, fixing bcachefs (loop0): Ratelimiting new instances of previous error bucket 0:11 gen 0 data type journal has wrong dirty_sectors: got 0, should be 256, fixing bcachefs (loop0): Ratelimiting new instances of previous error done bcachefs (loop0): going read-write bcachefs (loop0): journal_replay... ====================================================== WARNING: possible circular locking dependency detected 6.12.0-rc5-syzkaller-00322-gb9021de3ec2f #0 Not tainted ------------------------------------------------------ syz.0.0/5326 is trying to acquire lock: ffffffff8ea17308 (pcpu_alloc_mutex){+.+.}-{3:3}, at: pcpu_alloc_noprof+0x27f/0x16b0 mm/percpu.c:1795 but task is already holding lock: ffff88804fa01c50 (&bc->lock){+.+.}-{3:3}, at: bch2_btree_node_mem_alloc+0x4ec/0x1340 fs/bcachefs/btree_cache.c:782 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&bc->lock){+.+.}-{3:3}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752 bch2_btree_cache_scan+0x192/0xd00 fs/bcachefs/btree_cache.c:460 do_shrink_slab+0x701/0x1160 mm/shrinker.c:435 shrink_slab+0x1093/0x14d0 mm/shrinker.c:662 shrink_one+0x43b/0x850 mm/vmscan.c:4818 shrink_many mm/vmscan.c:4879 [inline] lru_gen_shrink_node mm/vmscan.c:4957 [inline] shrink_node+0x3791/0x3e20 mm/vmscan.c:5937 kswapd_shrink_node mm/vmscan.c:6765 [inline] balance_pgdat mm/vmscan.c:6957 [inline] kswapd+0x1ca3/0x3700 mm/vmscan.c:7226 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 -> #1 (fs_reclaim){+.+.}-{0:0}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825 __fs_reclaim_acquire mm/page_alloc.c:3834 [inline] fs_reclaim_acquire+0x88/0x130 mm/page_alloc.c:3848 might_alloc include/linux/sched/mm.h:318 [inline] slab_pre_alloc_hook mm/slub.c:4036 [inline] slab_alloc_node mm/slub.c:4114 [inline] __do_kmalloc_node mm/slub.c:4263 [inline] __kmalloc_noprof+0xa9/0x400 mm/slub.c:4276 kmalloc_noprof include/linux/slab.h:882 [inline] kzalloc_noprof include/linux/slab.h:1014 [inline] pcpu_mem_zalloc mm/percpu.c:510 [inline] pcpu_alloc_chunk mm/percpu.c:1443 [inline] pcpu_create_chunk+0x57/0xbc0 mm/percpu-vm.c:338 pcpu_balance_populated mm/percpu.c:2075 [inline] pcpu_balance_workfn+0xc4d/0xd40 mm/percpu.c:2212 process_one_work kernel/workqueue.c:3229 [inline] process_scheduled_works+0xa63/0x1850 kernel/workqueue.c:3310 worker_thread+0x870/0xd30 kernel/workqueue.c:3391 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 -> #0 (pcpu_alloc_mutex){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3904 __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5202 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752 pcpu_alloc_noprof+0x27f/0x16b0 mm/percpu.c:1795 __six_lock_init+0x104/0x150 fs/bcachefs/six.c:869 bch2_btree_lock_init+0x38/0x100 fs/bcachefs/btree_locking.c:12 bch2_btree_node_mem_alloc+0x4f8/0x1340 fs/bcachefs/btree_cache.c:785 __bch2_btree_node_alloc fs/bcachefs/btree_update_interior.c:325 [inline] bch2_btree_reserve_get+0x2df/0x1890 fs/bcachefs/btree_update_interior.c:554 bch2_btree_update_start+0xe56/0x14e0 fs/bcachefs/btree_update_interior.c:1252 bch2_btree_split_leaf+0x123/0x840 fs/bcachefs/btree_update_interior.c:1850 bch2_trans_commit_error+0x212/0x1390 fs/bcachefs/btree_trans_commit.c:942 __bch2_trans_commit+0x7ead/0x93c0 fs/bcachefs/btree_trans_commit.c:1140 bch2_trans_commit fs/bcachefs/btree_update.h:184 [inline] bch2_journal_replay+0x1a3a/0x2a40 fs/bcachefs/recovery.c:317 bch2_run_recovery_pass+0xf0/0x1e0 fs/bcachefs/recovery_passes.c:185 bch2_run_recovery_passes+0x387/0x870 fs/bcachefs/recovery_passes.c:232 bch2_fs_recovery+0x25cc/0x39c0 fs/bcachefs/recovery.c:861 bch2_fs_start+0x356/0x5b0 fs/bcachefs/super.c:1036 bch2_fs_get_tree+0xd68/0x1710 fs/bcachefs/fs.c:2170 vfs_get_tree+0x90/0x2b0 fs/super.c:1814 do_new_mount+0x2be/0xb40 fs/namespace.c:3507 do_mount fs/namespace.c:3847 [inline] __do_sys_mount fs/namespace.c:4057 [inline] __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:4034 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 other info that might help us debug this: Chain exists of: pcpu_alloc_mutex --> fs_reclaim --> &bc->lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&bc->lock); lock(fs_reclaim); lock(&bc->lock); lock(pcpu_alloc_mutex); *** DEADLOCK *** 4 locks held by syz.0.0/5326: #0: ffff88804fa00278 (&c->state_lock){+.+.}-{3:3}, at: bch2_fs_start+0x45/0x5b0 fs/bcachefs/super.c:1006 #1: ffff88804fa04398 (&c->btree_trans_barrier){.+.+}-{0:0}, at: srcu_lock_acquire include/linux/srcu.h:151 [inline] #1: ffff88804fa04398 (&c->btree_trans_barrier){.+.+}-{0:0}, at: srcu_read_lock include/linux/srcu.h:250 [inline] #1: ffff88804fa04398 (&c->btree_trans_barrier){.+.+}-{0:0}, at: __bch2_trans_get+0x7de/0xd20 fs/bcachefs/btree_iter.c:3228 #2: ffff88804fa266d0 (&c->gc_lock){++++}-{3:3}, at: bch2_btree_update_start+0x682/0x14e0 fs/bcachefs/btree_update_interior.c:1202 #3: ffff88804fa01c50 (&bc->lock){+.+.}-{3:3}, at: bch2_btree_node_mem_alloc+0x4ec/0x1340 fs/bcachefs/btree_cache.c:782 stack backtrace: CPU: 0 UID: 0 PID: 5326 Comm: syz.0.0 Not tainted 6.12.0-rc5-syzkaller-00322-gb9021de3ec2f #0 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 print_circular_bug+0x13a/0x1b0 kernel/locking/lockdep.c:2074 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2206 check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3904 __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5202 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752 pcpu_alloc_noprof+0x27f/0x16b0 mm/percpu.c:1795 __six_lock_init+0x104/0x150 fs/bcachefs/six.c:869 bch2_btree_lock_init+0x38/0x100 fs/bcachefs/btree_locking.c:12 bch2_btree_node_mem_alloc+0x4f8/0x1340 fs/bcachefs/btree_cache.c:785 __bch2_btree_node_alloc fs/bcachefs/btree_update_interior.c:325 [inline] bch2_btree_reserve_get+0x2df/0x1890 fs/bcachefs/btree_update_interior.c:554 bch2_btree_update_start+0xe56/0x14e0 fs/bcachefs/btree_update_interior.c:1252 bch2_btree_split_leaf+0x123/0x840 fs/bcachefs/btree_update_interior.c:1850 bch2_trans_commit_error+0x212/0x1390 fs/bcachefs/btree_trans_commit.c:942 __bch2_trans_commit+0x7ead/0x93c0 fs/bcachefs/btree_trans_commit.c:1140 bch2_trans_commit fs/bcachefs/btree_update.h:184 [inline] bch2_journal_replay+0x1a3a/0x2a40 fs/bcachefs/recovery.c:317 bch2_run_recovery_pass+0xf0/0x1e0 fs/bcachefs/recovery_passes.c:185 bch2_run_recovery_passes+0x387/0x870 fs/bcachefs/recovery_passes.c:232 bch2_fs_recovery+0x25cc/0x39c0 fs/bcachefs/recovery.c:861 bch2_fs_start+0x356/0x5b0 fs/bcachefs/super.c:1036 bch2_fs_get_tree+0xd68/0x1710 fs/bcachefs/fs.c:2170 vfs_get_tree+0x90/0x2b0 fs/super.c:1814 do_new_mount+0x2be/0xb40 fs/namespace.c:3507 do_mount fs/namespace.c:3847 [inline] __do_sys_mount fs/namespace.c:4057 [inline] __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:4034 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:0x7ff45577feba 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:00007ff4555fee68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007ff4555feef0 RCX: 00007ff45577feba RDX: 00000000200058c0 RSI: 0000000020000000 RDI: 00007ff4555feeb0 RBP: 00000000200058c0 R08: 00007ff4555feef0 R09: 0000000000010000 R10: 0000000000010000 R11: 0000000000000246 R12: 0000000020000000 R13: 00007ff4555feeb0 R14: 00000000000058df R15: 0000000020000680 done bcachefs (loop0): check_alloc_info... hole in alloc btree missing in freespace btree device 0 buckets 25-26, fixing hole in alloc btree missing in freespace btree device 0 buckets 29-30, fixing incorrect key in need_discard btree (got deleted should be set) u64s 13 type alloc_v4 0:31:0 len 0 ver 0: gen 0 oldest_gen 0 data_type need_discard journal_seq 4 need_discard 1 need_inc_gen 1 dirty_sectors 0 stripe_sectors 0 cached_sectors 0 stripe 0 stripe_redundancy 0 io_time[READ] 1 io_time[WRITE] 512 fragmentation 0 bp_start 8 , fixing hole in alloc btree missing in freespace btree device 0 buckets 33-34, fixing hole in alloc btree missing in freespace btree device 0 buckets 39-41, fixing hole in alloc btree missing in freespace btree device 0 buckets 43-120, fixing done bcachefs (loop0): check_lrus... done bcachefs (loop0): check_btree_backpointers... done bcachefs (loop0): check_backpointers_to_extents... backpointer for missing btree node u64s 9 type backpointer 0:8126464:0 len 0 ver 0: bucket=0:31:0 btree=xattrs l=1 offset=0:0 len=256 pos=SPOS_MAX, fixing done bcachefs (loop0): check_extents_to_backpointers... missing backpointer for btree=inodes l=1 u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq 7589ab5e0c11cc7a written 24 min_key POS_MIN durability: 1 ptr: 0:38:0 gen 0 got: u64s 5 type deleted 0:9961472:0 len 0 ver 0 want: u64s 9 type backpointer 0:9961472:0 len 0 ver 0: bucket=0:38:0 btree=inodes l=1 offset=0:0 len=256 pos=SPOS_MAX, fixing missing backpointer for btree=dirents l=1 u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq 9aa2895aefce4bdf written 24 min_key POS_MIN durability: 1 ptr: 0:41:0 gen 0 got: u64s 5 type deleted 0:10747904:0 len 0 ver 0 want: u64s 9 type backpointer 0:10747904:0 len 0 ver 0: bucket=0:41:0 btree=dirents l=1 offset=0:0 len=256 pos=SPOS_MAX, fixing missing backpointer for btree=alloc l=1 u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq ac62141f8dc7e261 written 48 min_key POS_MIN durability: 1 ptr: 0:26:0 gen 0 got: u64s 5 type deleted 0:6815744:0 len 0 ver 0 want: u64s 9 type backpointer 0:6815744:0 len 0 ver 0: bucket=0:26:0 btree=alloc l=1 offset=0:0 len=256 pos=SPOS_MAX, fixing missing backpointer for btree=subvolumes l=1 u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq c0bef60d07ceb940 written 16 min_key POS_MIN durability: 1 ptr: 0:35:0 gen 0 got: u64s 5 type deleted 0:9175040:0 len 0 ver 0 want: u64s 9 type backpointer 0:9175040:0 len 0 ver 0: bucket=0:35:0 btree=subvolumes l=1 offset=0:0 len=256 pos=SPOS_MAX, fixing missing backpointer for btree=snapshots l=1 u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq ebb8d5a9e3463bdb written 16 min_key POS_MIN durability: 1 ptr: 0:32:0 gen 0 got: u64s 5 type deleted 0:8388608:0 len 0 ver 0 want: u64s 9 type backpointer 0:8388608:0 len 0 ver 0: bucket=0:32:0 btree=snapshots l=1 offset=0:0 len=256 pos=SPOS_MAX, fixing 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 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... dirent points to missing inode: u64s 8 type dirent 4096:8130059955150870709:U32_MAX len 0 ver 0: lost+found -> 4097 type dir, fixing 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... done bcachefs (loop0): resume_logged_ops... done bcachefs (loop0): delete_dead_inodes... done bcachefs (loop0): set_fs_needs_rebalance... done bcachefs (loop0): Fixed errors, running fsck a second time to verify fs is clean 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... 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... 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... directory 4096:4294967295 with wrong i_nlink: got 2, should be 1, fixing 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... done bcachefs (loop0): resume_logged_ops... done bcachefs (loop0): delete_dead_inodes... done bcachefs (loop0): set_fs_needs_rebalance... done bcachefs (loop0): Second fsck run was not clean bcachefs (loop0): done starting filesystem syz.0.0 (5326) used greatest stack depth: 10032 bytes left