============================================ WARNING: possible recursive locking detected 6.1.86-syzkaller #0 Not tainted -------------------------------------------- syz-executor.1/4183 is trying to acquire lock: ffff888059a440b0 (&tree->tree_lock/1){+.+.}-{3:3}, at: hfs_find_init+0x16a/0x1e0 but task is already holding lock: ffff888059a440b0 (&tree->tree_lock/1){+.+.}-{3:3}, at: hfs_find_init+0x16a/0x1e0 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&tree->tree_lock/1); lock(&tree->tree_lock/1); *** DEADLOCK *** May be due to missing lock nesting notation 5 locks held by syz-executor.1/4183: #0: ffff888059a42460 (sb_writers#19){.+.+}-{0:0}, at: do_sys_ftruncate+0x251/0x380 fs/open.c:190 #1: ffff888054be1628 (&sb->s_type->i_mutex_key#27){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline] #1: ffff888054be1628 (&sb->s_type->i_mutex_key#27){+.+.}-{3:3}, at: do_truncate+0x208/0x300 fs/open.c:63 #2: ffff888054be1478 (&HFS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfs_extend_file+0xfb/0x1440 fs/hfs/extent.c:397 #3: ffff888059a440b0 (&tree->tree_lock/1){+.+.}-{3:3}, at: hfs_find_init+0x16a/0x1e0 #4: ffff888054be00f8 (&HFS_I(tree->inode)->extents_lock){+.+.}-{3:3}, at: hfs_extend_file+0xfb/0x1440 fs/hfs/extent.c:397 stack backtrace: CPU: 1 PID: 4183 Comm: syz-executor.1 Not tainted 6.1.86-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 print_deadlock_bug kernel/locking/lockdep.c:2983 [inline] check_deadlock kernel/locking/lockdep.c:3026 [inline] validate_chain+0x4711/0x5950 kernel/locking/lockdep.c:3812 __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_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 cont_expand_zero fs/buffer.c:2383 [inline] cont_write_begin+0x312/0x880 fs/buffer.c:2446 hfs_write_begin+0x86/0xd0 fs/hfs/inode.c:58 hfs_file_truncate+0x1e9/0xa10 fs/hfs/extent.c:494 hfs_inode_setattr+0x45d/0x6a0 fs/hfs/inode.c:656 notify_change+0xce3/0xfc0 fs/attr.c:499 do_truncate+0x21c/0x300 fs/open.c:65 do_sys_ftruncate+0x2e2/0x380 fs/open.c:193 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:0x7f284b27dea9 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:00007f284bf250c8 EFLAGS: 00000246 ORIG_RAX: 000000000000004d RAX: ffffffffffffffda RBX: 00007f284b3abf80 RCX: 00007f284b27dea9 RDX: 0000000000000000 RSI: 0000000008800000 RDI: 0000000000000004 RBP: 00007f284b2ca4a4 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f284b3abf80 R15: 00007ffdf97cadf8