====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ kworker/u8:6/1143 is trying to acquire lock: ffff88807d9bbb78 (&HFS_I(tree->inode)->extents_lock){+.+.}-{4:4}, at: hfs_extend_file+0xa5/0xcd0 fs/hfs/extent.c:397 but task is already holding lock: ffff88807ae4a0b0 (&tree->tree_lock#2/1){+.+.}-{4:4}, at: hfs_find_init+0x19c/0x310 fs/hfs/bfind.c:36 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&tree->tree_lock#2/1){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:598 [inline] __mutex_lock+0x193/0x1060 kernel/locking/mutex.c:760 hfs_find_init+0x19c/0x310 fs/hfs/bfind.c:36 hfs_ext_read_extent+0x19b/0x9e0 fs/hfs/extent.c:200 hfs_extend_file+0x519/0xcd0 fs/hfs/extent.c:401 hfs_bmap_reserve+0x2ab/0x3a0 fs/hfs/btree.c:269 hfs_cat_create+0x32c/0x960 fs/hfs/catalog.c:104 hfs_create+0x6b/0xf0 fs/hfs/dir.c:202 lookup_open.isra.0+0x11d3/0x1580 fs/namei.c:3796 open_last_lookups fs/namei.c:3895 [inline] path_openat+0x893/0x2cb0 fs/namei.c:4131 do_filp_open+0x20b/0x470 fs/namei.c:4161 do_sys_openat2+0x11b/0x1d0 fs/open.c:1437 do_sys_open fs/open.c:1452 [inline] __do_sys_open fs/open.c:1460 [inline] __se_sys_open fs/open.c:1456 [inline] __x64_sys_open+0x153/0x1e0 fs/open.c:1456 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&HFS_I(tree->inode)->extents_lock){+.+.}-{4:4}: check_prev_add kernel/locking/lockdep.c:3165 [inline] check_prevs_add kernel/locking/lockdep.c:3284 [inline] validate_chain kernel/locking/lockdep.c:3908 [inline] __lock_acquire+0x12a6/0x1ce0 kernel/locking/lockdep.c:5237 lock_acquire kernel/locking/lockdep.c:5868 [inline] lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5825 __mutex_lock_common kernel/locking/mutex.c:598 [inline] __mutex_lock+0x193/0x1060 kernel/locking/mutex.c:760 hfs_extend_file+0xa5/0xcd0 fs/hfs/extent.c:397 hfs_bmap_reserve+0x2ab/0x3a0 fs/hfs/btree.c:269 __hfs_ext_write_extent+0x3cf/0x520 fs/hfs/extent.c:121 hfs_ext_write_extent+0x1b5/0x1f0 fs/hfs/extent.c:144 hfs_write_inode+0xcc/0xab0 fs/hfs/inode.c:440 write_inode fs/fs-writeback.c:1564 [inline] __writeback_single_inode+0xb3e/0xfb0 fs/fs-writeback.c:1784 writeback_sb_inodes+0x60d/0xfa0 fs/fs-writeback.c:2015 wb_writeback+0x419/0xb70 fs/fs-writeback.c:2195 wb_do_writeback fs/fs-writeback.c:2342 [inline] wb_workfn+0x14d/0xbe0 fs/fs-writeback.c:2382 process_one_work+0x9cf/0x1b70 kernel/workqueue.c:3263 process_scheduled_works kernel/workqueue.c:3346 [inline] worker_thread+0x6c8/0xf10 kernel/workqueue.c:3427 kthread+0x3c5/0x780 kernel/kthread.c:463 ret_from_fork+0x675/0x7d0 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&tree->tree_lock#2/1); lock(&HFS_I(tree->inode)->extents_lock); lock(&tree->tree_lock#2/1); lock(&HFS_I(tree->inode)->extents_lock); *** DEADLOCK *** 3 locks held by kworker/u8:6/1143: #0: ffff888140e9d148 ((wq_completion)writeback){+.+.}-{0:0}, at: process_one_work+0x12a2/0x1b70 kernel/workqueue.c:3238 #1: ffffc90003a87d00 ((work_completion)(&(&wb->dwork)->work)){+.+.}-{0:0}, at: process_one_work+0x929/0x1b70 kernel/workqueue.c:3239 #2: ffff88807ae4a0b0 (&tree->tree_lock#2/1){+.+.}-{4:4}, at: hfs_find_init+0x19c/0x310 fs/hfs/bfind.c:36 stack backtrace: CPU: 1 UID: 0 PID: 1143 Comm: kworker/u8:6 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025 Workqueue: writeback wb_workfn (flush-7:4) Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_circular_bug+0x275/0x350 kernel/locking/lockdep.c:2043 check_noncircular+0x14c/0x170 kernel/locking/lockdep.c:2175 check_prev_add kernel/locking/lockdep.c:3165 [inline] check_prevs_add kernel/locking/lockdep.c:3284 [inline] validate_chain kernel/locking/lockdep.c:3908 [inline] __lock_acquire+0x12a6/0x1ce0 kernel/locking/lockdep.c:5237 lock_acquire kernel/locking/lockdep.c:5868 [inline] lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5825 __mutex_lock_common kernel/locking/mutex.c:598 [inline] __mutex_lock+0x193/0x1060 kernel/locking/mutex.c:760 hfs_extend_file+0xa5/0xcd0 fs/hfs/extent.c:397 hfs_bmap_reserve+0x2ab/0x3a0 fs/hfs/btree.c:269 __hfs_ext_write_extent+0x3cf/0x520 fs/hfs/extent.c:121 hfs_ext_write_extent+0x1b5/0x1f0 fs/hfs/extent.c:144 hfs_write_inode+0xcc/0xab0 fs/hfs/inode.c:440 write_inode fs/fs-writeback.c:1564 [inline] __writeback_single_inode+0xb3e/0xfb0 fs/fs-writeback.c:1784 writeback_sb_inodes+0x60d/0xfa0 fs/fs-writeback.c:2015 wb_writeback+0x419/0xb70 fs/fs-writeback.c:2195 wb_do_writeback fs/fs-writeback.c:2342 [inline] wb_workfn+0x14d/0xbe0 fs/fs-writeback.c:2382 process_one_work+0x9cf/0x1b70 kernel/workqueue.c:3263 process_scheduled_works kernel/workqueue.c:3346 [inline] worker_thread+0x6c8/0xf10 kernel/workqueue.c:3427 kthread+0x3c5/0x780 kernel/kthread.c:463 ret_from_fork+0x675/0x7d0 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 hfs: new node 0 already hashed? ------------[ cut here ]------------ WARNING: CPU: 1 PID: 1143 at fs/hfs/bnode.c:520 hfs_bnode_create+0x14c/0x5e0 fs/hfs/bnode.c:520 Modules linked in: CPU: 1 UID: 0 PID: 1143 Comm: kworker/u8:6 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025 Workqueue: writeback wb_workfn (flush-7:4) RIP: 0010:hfs_bnode_create+0x14c/0x5e0 fs/hfs/bnode.c:520 Code: d7 18 ff 45 39 fc 75 9e e8 61 dd 18 ff 4c 89 f7 e8 89 92 c2 08 e8 54 dd 18 ff 44 89 e6 48 c7 c7 60 db aa 8b e8 95 31 f7 fe 90 <0f> 0b 90 e8 3c dd 18 ff 48 89 d8 48 83 c4 28 5b 5d 41 5c 41 5d 41 RSP: 0018:ffffc90003a87070 EFLAGS: 00010286 RAX: 000000000000001f RBX: ffff888145b54d00 RCX: ffffffff819acb09 RDX: 0000000000000000 RSI: ffffffff819b4636 RDI: 0000000000000005 RBP: ffff88807ae4a000 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000080000000 R11: 77656e203a736668 R12: 0000000000000000 R13: dffffc0000000000 R14: ffff88807ae4a0e0 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff888124ade000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00005555615e4808 CR3: 0000000044e47000 CR4: 0000000000350ef0 Call Trace: hfs_bmap_alloc+0x7d7/0x960 fs/hfs/btree.c:326 hfs_btree_inc_height.isra.0+0xff/0x820 fs/hfs/brec.c:490 hfs_brec_insert+0x8b1/0xc40 fs/hfs/brec.c:148 __hfs_ext_write_extent+0x3fa/0x520 fs/hfs/extent.c:124 hfs_ext_write_extent+0x1b5/0x1f0 fs/hfs/extent.c:144 hfs_write_inode+0xcc/0xab0 fs/hfs/inode.c:440 write_inode fs/fs-writeback.c:1564 [inline] __writeback_single_inode+0xb3e/0xfb0 fs/fs-writeback.c:1784 writeback_sb_inodes+0x60d/0xfa0 fs/fs-writeback.c:2015 wb_writeback+0x419/0xb70 fs/fs-writeback.c:2195 wb_do_writeback fs/fs-writeback.c:2342 [inline] wb_workfn+0x14d/0xbe0 fs/fs-writeback.c:2382 process_one_work+0x9cf/0x1b70 kernel/workqueue.c:3263 process_scheduled_works kernel/workqueue.c:3346 [inline] worker_thread+0x6c8/0xf10 kernel/workqueue.c:3427 kthread+0x3c5/0x780 kernel/kthread.c:463 ret_from_fork+0x675/0x7d0 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245