F2FS-fs (loop4): Mounted with checkpoint version = 48b305e5 ====================================================== WARNING: possible circular locking dependency detected 6.5.0-rc3-next-20230727-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.4/9091 is trying to acquire lock: ffff88803be52b28 (&fi->i_xattr_sem){.+.+}-{3:3}, at: f2fs_down_read fs/f2fs/f2fs.h:2108 [inline] ffff88803be52b28 (&fi->i_xattr_sem){.+.+}-{3:3}, at: f2fs_getxattr+0xb1e/0x12c0 fs/f2fs/xattr.c:532 but task is already holding lock: ffff88803be53160 (&fi->i_sem){+.+.}-{3:3}, at: f2fs_down_write fs/f2fs/f2fs.h:2133 [inline] ffff88803be53160 (&fi->i_sem){+.+.}-{3:3}, at: f2fs_add_regular_entry+0x78b/0xb90 fs/f2fs/dir.c:739 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&fi->i_sem){+.+.}-{3:3}: down_write+0x93/0x200 kernel/locking/rwsem.c:1573 f2fs_down_write fs/f2fs/f2fs.h:2133 [inline] f2fs_add_inline_entry+0x300/0x6f0 fs/f2fs/inline.c:644 f2fs_add_dentry+0xa6/0x230 fs/f2fs/dir.c:784 f2fs_do_add_link+0x190/0x280 fs/f2fs/dir.c:827 f2fs_add_link fs/f2fs/f2fs.h:3556 [inline] f2fs_create+0x3b3/0x650 fs/f2fs/namei.c:377 lookup_open.isra.0+0x1049/0x1360 fs/namei.c:3492 open_last_lookups fs/namei.c:3560 [inline] path_openat+0x931/0x29c0 fs/namei.c:3790 do_filp_open+0x1de/0x430 fs/namei.c:3820 do_sys_openat2+0x176/0x1e0 fs/open.c:1418 do_sys_open fs/open.c:1433 [inline] __do_sys_openat fs/open.c:1449 [inline] __se_sys_openat fs/open.c:1444 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1444 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #0 (&fi->i_xattr_sem){.+.+}-{3:3}: check_prev_add kernel/locking/lockdep.c:3142 [inline] check_prevs_add kernel/locking/lockdep.c:3261 [inline] validate_chain kernel/locking/lockdep.c:3876 [inline] __lock_acquire+0x2e3d/0x5de0 kernel/locking/lockdep.c:5144 lock_acquire kernel/locking/lockdep.c:5761 [inline] lock_acquire+0x1ae/0x510 kernel/locking/lockdep.c:5726 down_read+0x9c/0x470 kernel/locking/rwsem.c:1520 f2fs_down_read fs/f2fs/f2fs.h:2108 [inline] f2fs_getxattr+0xb1e/0x12c0 fs/f2fs/xattr.c:532 __f2fs_get_acl+0x5a/0x900 fs/f2fs/acl.c:179 f2fs_acl_create fs/f2fs/acl.c:377 [inline] f2fs_init_acl+0x15c/0xb30 fs/f2fs/acl.c:420 f2fs_init_inode_metadata+0x159/0x1290 fs/f2fs/dir.c:558 f2fs_add_regular_entry+0x79e/0xb90 fs/f2fs/dir.c:740 f2fs_add_dentry+0x1de/0x230 fs/f2fs/dir.c:788 f2fs_do_add_link+0x190/0x280 fs/f2fs/dir.c:827 f2fs_add_link fs/f2fs/f2fs.h:3556 [inline] f2fs_create+0x3b3/0x650 fs/f2fs/namei.c:377 lookup_open.isra.0+0x1049/0x1360 fs/namei.c:3492 open_last_lookups fs/namei.c:3560 [inline] path_openat+0x931/0x29c0 fs/namei.c:3790 do_filp_open+0x1de/0x430 fs/namei.c:3820 do_sys_openat2+0x176/0x1e0 fs/open.c:1418 do_sys_open fs/open.c:1433 [inline] __do_sys_open fs/open.c:1441 [inline] __se_sys_open fs/open.c:1437 [inline] __x64_sys_open+0x154/0x1e0 fs/open.c:1437 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/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(&fi->i_sem); lock(&fi->i_xattr_sem); lock(&fi->i_sem); rlock(&fi->i_xattr_sem); *** DEADLOCK *** 4 locks held by syz-executor.4/9091: #0: ffff88803a262410 (sb_writers#17){.+.+}-{0:0}, at: open_last_lookups fs/namei.c:3549 [inline] #0: ffff88803a262410 (sb_writers#17){.+.+}-{0:0}, at: path_openat+0x197e/0x29c0 fs/namei.c:3790 #1: ffff88803be524b0 (&type->i_mutex_dir_key#11){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:802 [inline] #1: ffff88803be524b0 (&type->i_mutex_dir_key#11){+.+.}-{3:3}, at: open_last_lookups fs/namei.c:3557 [inline] #1: ffff88803be524b0 (&type->i_mutex_dir_key#11){+.+.}-{3:3}, at: path_openat+0x8c9/0x29c0 fs/namei.c:3790 #2: ffff88807c3d83b0 (&sbi->cp_rwsem){++++}-{3:3}, at: f2fs_down_read fs/f2fs/f2fs.h:2108 [inline] #2: ffff88807c3d83b0 (&sbi->cp_rwsem){++++}-{3:3}, at: f2fs_lock_op fs/f2fs/f2fs.h:2151 [inline] #2: ffff88807c3d83b0 (&sbi->cp_rwsem){++++}-{3:3}, at: f2fs_create+0x2d7/0x650 fs/f2fs/namei.c:376 #3: ffff88803be53160 (&fi->i_sem){+.+.}-{3:3}, at: f2fs_down_write fs/f2fs/f2fs.h:2133 [inline] #3: ffff88803be53160 (&fi->i_sem){+.+.}-{3:3}, at: f2fs_add_regular_entry+0x78b/0xb90 fs/f2fs/dir.c:739 stack backtrace: CPU: 1 PID: 9091 Comm: syz-executor.4 Not tainted 6.5.0-rc3-next-20230727-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 check_noncircular+0x311/0x3f0 kernel/locking/lockdep.c:2195 check_prev_add kernel/locking/lockdep.c:3142 [inline] check_prevs_add kernel/locking/lockdep.c:3261 [inline] validate_chain kernel/locking/lockdep.c:3876 [inline] __lock_acquire+0x2e3d/0x5de0 kernel/locking/lockdep.c:5144 lock_acquire kernel/locking/lockdep.c:5761 [inline] lock_acquire+0x1ae/0x510 kernel/locking/lockdep.c:5726 down_read+0x9c/0x470 kernel/locking/rwsem.c:1520 f2fs_down_read fs/f2fs/f2fs.h:2108 [inline] f2fs_getxattr+0xb1e/0x12c0 fs/f2fs/xattr.c:532 __f2fs_get_acl+0x5a/0x900 fs/f2fs/acl.c:179 f2fs_acl_create fs/f2fs/acl.c:377 [inline] f2fs_init_acl+0x15c/0xb30 fs/f2fs/acl.c:420 f2fs_init_inode_metadata+0x159/0x1290 fs/f2fs/dir.c:558 f2fs_add_regular_entry+0x79e/0xb90 fs/f2fs/dir.c:740 f2fs_add_dentry+0x1de/0x230 fs/f2fs/dir.c:788 f2fs_do_add_link+0x190/0x280 fs/f2fs/dir.c:827 f2fs_add_link fs/f2fs/f2fs.h:3556 [inline] f2fs_create+0x3b3/0x650 fs/f2fs/namei.c:377 lookup_open.isra.0+0x1049/0x1360 fs/namei.c:3492 open_last_lookups fs/namei.c:3560 [inline] path_openat+0x931/0x29c0 fs/namei.c:3790 do_filp_open+0x1de/0x430 fs/namei.c:3820 do_sys_openat2+0x176/0x1e0 fs/open.c:1418 do_sys_open fs/open.c:1433 [inline] __do_sys_open fs/open.c:1441 [inline] __se_sys_open fs/open.c:1437 [inline] __x64_sys_open+0x154/0x1e0 fs/open.c:1437 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f3f8de7cb29 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:00007f3f8eb3b0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 00007f3f8df9bf80 RCX: 00007f3f8de7cb29 RDX: 0000000000000000 RSI: 0000000000064842 RDI: 00000000200005c0 RBP: 00007f3f8dec847a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f3f8df9bf80 R15: 00007ffc7c847e48