stripe 0 stripe_redundancy 0 io_time[READ] 1 io_time[WRITE] 1024 fragmentation 0 bp_start 8 incorrectly set at freespace:0:37:0 (free 0, genbits 0 should be 0), fixing ============================================ WARNING: possible recursive locking detected 6.12.0-next-20241128-syzkaller #0 Not tainted -------------------------------------------- kworker/u8:6/3489 is trying to acquire lock: ffff888057d1dc38 (&wp->lock){+.+.}-{4:4}, at: bch2_trans_mutex_lock_norelock fs/bcachefs/alloc_foreground.c:43 [inline] ffff888057d1dc38 (&wp->lock){+.+.}-{4:4}, at: writepoint_find fs/bcachefs/alloc_foreground.c:1221 [inline] ffff888057d1dc38 (&wp->lock){+.+.}-{4:4}, at: bch2_alloc_sectors_start_trans+0x956/0x2030 fs/bcachefs/alloc_foreground.c:1327 but task is already holding lock: ffff888057d1dc38 (&wp->lock){+.+.}-{4:4}, at: bch2_trans_mutex_lock_norelock fs/bcachefs/alloc_foreground.c:41 [inline] ffff888057d1dc38 (&wp->lock){+.+.}-{4:4}, at: writepoint_find fs/bcachefs/alloc_foreground.c:1221 [inline] ffff888057d1dc38 (&wp->lock){+.+.}-{4:4}, at: bch2_alloc_sectors_start_trans+0x2e8/0x2030 fs/bcachefs/alloc_foreground.c:1327 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&wp->lock); lock(&wp->lock); *** DEADLOCK *** May be due to missing lock nesting notation 6 locks held by kworker/u8:6/3489: #0: ffff88802df33148 ((wq_completion)btree_node_rewrite){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3204 [inline] #0: ffff88802df33148 ((wq_completion)btree_node_rewrite){+.+.}-{0:0}, at: process_scheduled_works+0x93b/0x1840 kernel/workqueue.c:3310 #1: ffffc9000c2f7d00 ((work_completion)(&a->work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3205 [inline] #1: ffffc9000c2f7d00 ((work_completion)(&a->work)){+.+.}-{0:0}, at: process_scheduled_works+0x976/0x1840 kernel/workqueue.c:3310 #2: ffff888057d043a8 (&c->btree_trans_barrier){.+.+}-{0:0}, at: srcu_lock_acquire include/linux/srcu.h:158 [inline] #2: ffff888057d043a8 (&c->btree_trans_barrier){.+.+}-{0:0}, at: srcu_read_lock include/linux/srcu.h:249 [inline] #2: ffff888057d043a8 (&c->btree_trans_barrier){.+.+}-{0:0}, at: bch2_trans_srcu_lock+0x9a/0x1a0 fs/bcachefs/btree_iter.c:3179 #3: ffff888057d26710 (&c->gc_lock){++++}-{4:4}, at: bch2_btree_update_start+0x682/0x14e0 fs/bcachefs/btree_update_interior.c:1191 #4: ffff888057d1dc38 (&wp->lock){+.+.}-{4:4}, at: bch2_trans_mutex_lock_norelock fs/bcachefs/alloc_foreground.c:41 [inline] #4: ffff888057d1dc38 (&wp->lock){+.+.}-{4:4}, at: writepoint_find fs/bcachefs/alloc_foreground.c:1221 [inline] #4: ffff888057d1dc38 (&wp->lock){+.+.}-{4:4}, at: bch2_alloc_sectors_start_trans+0x2e8/0x2030 fs/bcachefs/alloc_foreground.c:1327 #5: ffff888057d26710 (&c->gc_lock){++++}-{4:4}, at: bch2_btree_update_start+0x682/0x14e0 fs/bcachefs/btree_update_interior.c:1191 stack backtrace: CPU: 1 UID: 0 PID: 3489 Comm: kworker/u8:6 Not tainted 6.12.0-next-20241128-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Workqueue: btree_node_rewrite async_btree_node_rewrite_work Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_deadlock_bug+0x483/0x620 kernel/locking/lockdep.c:3037 check_deadlock kernel/locking/lockdep.c:3089 [inline] validate_chain+0x15e2/0x5920 kernel/locking/lockdep.c:3891 __lock_acquire+0x1397/0x2100 kernel/locking/lockdep.c:5226 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849 __mutex_lock_common kernel/locking/mutex.c:585 [inline] __mutex_lock+0x1ac/0xee0 kernel/locking/mutex.c:735 bch2_trans_mutex_lock_norelock fs/bcachefs/alloc_foreground.c:43 [inline] writepoint_find fs/bcachefs/alloc_foreground.c:1221 [inline] bch2_alloc_sectors_start_trans+0x956/0x2030 fs/bcachefs/alloc_foreground.c:1327 __bch2_btree_node_alloc fs/bcachefs/btree_update_interior.c:333 [inline] bch2_btree_reserve_get+0x612/0x1890 fs/bcachefs/btree_update_interior.c:543 bch2_btree_update_start+0xe56/0x14e0 fs/bcachefs/btree_update_interior.c:1241 bch2_btree_split_leaf+0x121/0x880 fs/bcachefs/btree_update_interior.c:1862 bch2_trans_commit_error+0x212/0x1380 fs/bcachefs/btree_trans_commit.c:923 __bch2_trans_commit+0x819e/0x9760 fs/bcachefs/btree_trans_commit.c:1100 bch2_trans_commit fs/bcachefs/btree_update.h:182 [inline] bch2_check_discard_freespace_key+0xba7/0x1120 fs/bcachefs/alloc_background.c:1385 try_alloc_bucket fs/bcachefs/alloc_foreground.c:284 [inline] bch2_bucket_alloc_freelist fs/bcachefs/alloc_foreground.c:431 [inline] bch2_bucket_alloc_trans+0x158b/0x2fd0 fs/bcachefs/alloc_foreground.c:562 bch2_bucket_alloc_set_trans+0x517/0xd30 fs/bcachefs/alloc_foreground.c:722 __open_bucket_add_buckets+0x13d0/0x1ec0 fs/bcachefs/alloc_foreground.c:971 open_bucket_add_buckets+0x33a/0x410 fs/bcachefs/alloc_foreground.c:1015 bch2_alloc_sectors_start_trans+0xce9/0x2030 __bch2_btree_node_alloc fs/bcachefs/btree_update_interior.c:333 [inline] bch2_btree_reserve_get+0x612/0x1890 fs/bcachefs/btree_update_interior.c:543 bch2_btree_update_start+0xe56/0x14e0 fs/bcachefs/btree_update_interior.c:1241 bch2_btree_node_rewrite+0x1c0/0x1270 fs/bcachefs/btree_update_interior.c:2153 async_btree_node_rewrite_trans fs/bcachefs/btree_update_interior.c:2241 [inline] async_btree_node_rewrite_work+0x31e/0xdf0 fs/bcachefs/btree_update_interior.c:2254 process_one_work kernel/workqueue.c:3229 [inline] process_scheduled_works+0xa66/0x1840 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