loop2: detected capacity change from 0 to 64 ====================================================== WARNING: possible circular locking dependency detected 6.1.91-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.2/17759 is trying to acquire lock: ffff8880604640b0 (&tree->tree_lock#2/1){+.+.}-{3:3}, at: hfs_find_init+0x16a/0x1e0 but task is already holding lock: ffff8880762027f8 (&HFS_I(tree->inode)->extents_lock){+.+.}-{3:3}, at: hfs_extend_file+0xfb/0x1440 fs/hfs/extent.c:397 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&HFS_I(tree->inode)->extents_lock){+.+.}-{3:3}: lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747 hfs_extend_file+0xfb/0x1440 fs/hfs/extent.c:397 hfs_bmap_reserve+0xd5/0x3f0 fs/hfs/btree.c:234 __hfs_ext_write_extent+0x22e/0x4f0 fs/hfs/extent.c:121 __hfs_ext_cache_extent+0x6a/0x990 fs/hfs/extent.c:174 hfs_ext_read_extent fs/hfs/extent.c:202 [inline] hfs_extend_file+0x340/0x1440 fs/hfs/extent.c:401 hfs_get_block+0x3e0/0xb60 fs/hfs/extent.c:353 __block_write_begin_int+0x544/0x1a30 fs/buffer.c:1991 __block_write_begin fs/buffer.c:2041 [inline] block_write_begin+0x98/0x1f0 fs/buffer.c:2102 cont_write_begin+0x63f/0x880 fs/buffer.c:2456 hfs_write_begin+0x86/0xd0 fs/hfs/inode.c:58 generic_perform_write+0x2fc/0x5e0 mm/filemap.c:3817 __generic_file_write_iter+0x176/0x400 mm/filemap.c:3945 generic_file_write_iter+0xab/0x310 mm/filemap.c:3977 call_write_iter include/linux/fs.h:2265 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x7ae/0xba0 fs/read_write.c:584 ksys_write+0x19c/0x2c0 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 -> #0 (&tree->tree_lock#2/1){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3090 [inline] check_prevs_add kernel/locking/lockdep.c:3209 [inline] validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747 hfs_find_init+0x16a/0x1e0 hfs_ext_read_extent fs/hfs/extent.c:200 [inline] hfs_extend_file+0x317/0x1440 fs/hfs/extent.c:401 hfs_bmap_reserve+0xd5/0x3f0 fs/hfs/btree.c:234 hfs_cat_move+0x1b7/0x1050 fs/hfs/catalog.c:310 hfs_rename+0x242/0x320 fs/hfs/dir.c:299 vfs_rename+0xd32/0x10f0 fs/namei.c:4876 do_renameat2+0xde0/0x1440 fs/namei.c:5029 __do_sys_rename fs/namei.c:5075 [inline] __se_sys_rename fs/namei.c:5073 [inline] __x64_sys_rename+0x82/0x90 fs/namei.c:5073 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&HFS_I(tree->inode)->extents_lock); lock(&tree->tree_lock#2/1); lock(&HFS_I(tree->inode)->extents_lock); lock(&tree->tree_lock#2/1); *** DEADLOCK *** 4 locks held by syz-executor.2/17759: #0: ffff888060462460 (sb_writers#27){.+.+}-{0:0}, at: mnt_want_write+0x3b/0x80 fs/namespace.c:393 #1: ffff8880762077a8 (&type->i_mutex_dir_key#22/1){+.+.}-{3:3}, at: do_renameat2+0x65a/0x1440 fs/namei.c:4968 #2: ffff8880604660b0 (&tree->tree_lock#2){+.+.}-{3:3}, at: hfs_find_init+0x16a/0x1e0 #3: ffff8880762027f8 (&HFS_I(tree->inode)->extents_lock){+.+.}-{3:3}, at: hfs_extend_file+0xfb/0x1440 fs/hfs/extent.c:397 stack backtrace: CPU: 1 PID: 17759 Comm: syz-executor.2 Not tainted 6.1.91-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 check_noncircular+0x2fa/0x3b0 kernel/locking/lockdep.c:2170 check_prev_add kernel/locking/lockdep.c:3090 [inline] check_prevs_add kernel/locking/lockdep.c:3209 [inline] validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747 hfs_find_init+0x16a/0x1e0 hfs_ext_read_extent fs/hfs/extent.c:200 [inline] hfs_extend_file+0x317/0x1440 fs/hfs/extent.c:401 hfs_bmap_reserve+0xd5/0x3f0 fs/hfs/btree.c:234 hfs_cat_move+0x1b7/0x1050 fs/hfs/catalog.c:310 hfs_rename+0x242/0x320 fs/hfs/dir.c:299 vfs_rename+0xd32/0x10f0 fs/namei.c:4876 do_renameat2+0xde0/0x1440 fs/namei.c:5029 __do_sys_rename fs/namei.c:5075 [inline] __se_sys_rename fs/namei.c:5073 [inline] __x64_sys_rename+0x82/0x90 fs/namei.c:5073 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 RIP: 0033:0x7fa0d387cee9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fa0d45f60c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000052 RAX: ffffffffffffffda RBX: 00007fa0d39abf80 RCX: 00007fa0d387cee9 RDX: 0000000000000000 RSI: 0000000020000f40 RDI: 0000000020000600 RBP: 00007fa0d38c949e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007fa0d39abf80 R15: 00007ffca4078108 hfs: request for non-existent node 16777216 in B*Tree hfs: request for non-existent node 16777216 in B*Tree