loop4: detected capacity change from 0 to 64 ====================================================== WARNING: possible circular locking dependency detected 6.2.0-rc1-syzkaller-00116-g150aae354b81 #0 Not tainted ------------------------------------------------------ syz-executor.4/32449 is trying to acquire lock: ffff88807a7040b0 (&tree->tree_lock#2/1){+.+.}-{3:3}, at: hfs_find_init+0x182/0x240 fs/hfs/bfind.c:33 but task is already holding lock: ffff88802cd92178 (&HFS_I(tree->inode)->extents_lock){+.+.}-{3:3}, at: hfs_extend_file+0x97/0xae0 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}: __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1360 kernel/locking/mutex.c:747 hfs_extend_file+0x97/0xae0 fs/hfs/extent.c:397 hfs_bmap_reserve+0x29f/0x380 fs/hfs/btree.c:234 __hfs_ext_write_extent+0x3c1/0x510 fs/hfs/extent.c:121 __hfs_ext_cache_extent fs/hfs/extent.c:174 [inline] hfs_ext_read_extent+0x81c/0xa20 fs/hfs/extent.c:202 hfs_extend_file+0x4b5/0xae0 fs/hfs/extent.c:401 hfs_get_block+0x17f/0x820 fs/hfs/extent.c:353 __block_write_begin_int+0x3bd/0x14b0 fs/buffer.c:1991 __block_write_begin fs/buffer.c:2041 [inline] block_write_begin+0xb9/0x4d0 fs/buffer.c:2102 cont_write_begin+0x534/0x740 fs/buffer.c:2456 hfs_write_begin+0x87/0x150 fs/hfs/inode.c:58 cont_expand_zero fs/buffer.c:2383 [inline] cont_write_begin+0x334/0x740 fs/buffer.c:2446 hfs_write_begin+0x87/0x150 fs/hfs/inode.c:58 generic_perform_write+0x256/0x570 mm/filemap.c:3772 __generic_file_write_iter+0x2ae/0x500 mm/filemap.c:3900 generic_file_write_iter+0xe3/0x350 mm/filemap.c:3932 call_write_iter include/linux/fs.h:2186 [inline] do_iter_readv_writev+0x20b/0x3b0 fs/read_write.c:735 do_iter_write+0x182/0x700 fs/read_write.c:861 vfs_writev+0x1aa/0x630 fs/read_write.c:934 do_pwritev+0x1b6/0x270 fs/read_write.c:1031 __do_sys_pwritev2 fs/read_write.c:1090 [inline] __se_sys_pwritev2 fs/read_write.c:1081 [inline] __x64_sys_pwritev2+0xef/0x150 fs/read_write.c:1081 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #0 (&tree->tree_lock#2/1){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3097 [inline] check_prevs_add kernel/locking/lockdep.c:3216 [inline] validate_chain kernel/locking/lockdep.c:3831 [inline] __lock_acquire+0x2a43/0x56d0 kernel/locking/lockdep.c:5055 lock_acquire kernel/locking/lockdep.c:5668 [inline] lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1360 kernel/locking/mutex.c:747 hfs_find_init+0x182/0x240 fs/hfs/bfind.c:33 hfs_ext_read_extent+0x18d/0xa20 fs/hfs/extent.c:200 hfs_extend_file+0x4b5/0xae0 fs/hfs/extent.c:401 hfs_bmap_reserve+0x29f/0x380 fs/hfs/btree.c:234 hfs_cat_move+0x23e/0xd70 fs/hfs/catalog.c:310 hfs_rename+0xec/0x210 fs/hfs/dir.c:299 vfs_rename+0x1162/0x1a90 fs/namei.c:4779 do_renameat2+0xb22/0xc30 fs/namei.c:4930 __do_sys_renameat2 fs/namei.c:4963 [inline] __se_sys_renameat2 fs/namei.c:4960 [inline] __x64_sys_renameat2+0xe8/0x120 fs/namei.c:4960 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd 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 *** 7 locks held by syz-executor.4/32449: #0: ffff88807667c460 (sb_writers#29){.+.+}-{0:0}, at: do_renameat2+0x37f/0xc30 fs/namei.c:4866 #1: ffff88807667c748 (&type->s_vfs_rename_key#3){+.+.}-{3:3}, at: lock_rename+0x58/0x280 fs/namei.c:2994 #2: ffff88802cd929a8 (&type->i_mutex_dir_key#18/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:791 [inline] #2: ffff88802cd929a8 (&type->i_mutex_dir_key#18/1){+.+.}-{3:3}, at: lock_rename+0x136/0x280 fs/namei.c:3005 #3: ffff88802cd93028 (&type->i_mutex_dir_key#18/2){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:791 [inline] #3: ffff88802cd93028 (&type->i_mutex_dir_key#18/2){+.+.}-{3:3}, at: lock_rename+0x16a/0x280 fs/namei.c:3006 #4: ffff88802cd936a8 (&sb->s_type->i_mutex_key#34/4){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:791 [inline] #4: ffff88802cd936a8 (&sb->s_type->i_mutex_key#34/4){+.+.}-{3:3}, at: lock_two_nondirectories+0xd5/0x110 fs/inode.c:1123 #5: ffff88807a7020b0 (&tree->tree_lock#2){+.+.}-{3:3}, at: hfs_find_init+0x1c9/0x240 fs/hfs/bfind.c:30 #6: ffff88802cd92178 (&HFS_I(tree->inode)->extents_lock){+.+.}-{3:3}, at: hfs_extend_file+0x97/0xae0 fs/hfs/extent.c:397 stack backtrace: CPU: 1 PID: 32449 Comm: syz-executor.4 Not tainted 6.2.0-rc1-syzkaller-00116-g150aae354b81 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2177 check_prev_add kernel/locking/lockdep.c:3097 [inline] check_prevs_add kernel/locking/lockdep.c:3216 [inline] validate_chain kernel/locking/lockdep.c:3831 [inline] __lock_acquire+0x2a43/0x56d0 kernel/locking/lockdep.c:5055 lock_acquire kernel/locking/lockdep.c:5668 [inline] lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1360 kernel/locking/mutex.c:747 hfs_find_init+0x182/0x240 fs/hfs/bfind.c:33 hfs_ext_read_extent+0x18d/0xa20 fs/hfs/extent.c:200 hfs_extend_file+0x4b5/0xae0 fs/hfs/extent.c:401 hfs_bmap_reserve+0x29f/0x380 fs/hfs/btree.c:234 hfs_cat_move+0x23e/0xd70 fs/hfs/catalog.c:310 hfs_rename+0xec/0x210 fs/hfs/dir.c:299 vfs_rename+0x1162/0x1a90 fs/namei.c:4779 do_renameat2+0xb22/0xc30 fs/namei.c:4930 __do_sys_renameat2 fs/namei.c:4963 [inline] __se_sys_renameat2 fs/namei.c:4960 [inline] __x64_sys_renameat2+0xe8/0x120 fs/namei.c:4960 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f0187c8c0a9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f0188a27168 EFLAGS: 00000246 ORIG_RAX: 000000000000013c RAX: ffffffffffffffda RBX: 00007f0187dabf80 RCX: 00007f0187c8c0a9 RDX: 0000000000000004 RSI: 00000000200001c0 RDI: 0000000000000005 RBP: 00007f0187ce7ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000020000340 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffe00800a5f R14: 00007f0188a27300 R15: 0000000000022000