EXT4-fs (loop0): 1 truncate cleaned up
EXT4-fs (loop0): mounted filesystem without journal. Opts: i_version,nombcache,debug_want_extra_isize=0x0000000000000068,lazytime,block_validity,sysvgroups,,errors=continue. Quota mode: none.
======================================================
WARNING: possible circular locking dependency detected
5.15.184-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor202/4293 is trying to acquire lock:
ffff88807176e7a0 (&sb->s_type->i_mutex_key#9/1){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:787 [inline]
ffff88807176e7a0 (&sb->s_type->i_mutex_key#9/1){+.+.}-{3:3}, at: ext4_xattr_inode_create fs/ext4/xattr.c:1474 [inline]
ffff88807176e7a0 (&sb->s_type->i_mutex_key#9/1){+.+.}-{3:3}, at: ext4_xattr_inode_lookup_create fs/ext4/xattr.c:1556 [inline]
ffff88807176e7a0 (&sb->s_type->i_mutex_key#9/1){+.+.}-{3:3}, at: ext4_xattr_set_entry+0x34fb/0x3d30 fs/ext4/xattr.c:1684
but task is already holding lock:
ffff8880716a5c30 (&ei->i_data_sem/3){++++}-{3:3}, at: ext4_setattr+0x133d/0x19e0 fs/ext4/inode.c:5545
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (&ei->i_data_sem/3){++++}-{3:3}:
down_write+0x38/0x60 kernel/locking/rwsem.c:1551
ext4_update_i_disksize fs/ext4/ext4.h:3401 [inline]
ext4_xattr_inode_write fs/ext4/xattr.c:1412 [inline]
ext4_xattr_inode_lookup_create fs/ext4/xattr.c:1560 [inline]
ext4_xattr_set_entry+0x32c3/0x3d30 fs/ext4/xattr.c:1684
ext4_xattr_ibody_set+0x112/0x330 fs/ext4/xattr.c:2252
ext4_xattr_set_handle+0xa7c/0x12b0 fs/ext4/xattr.c:2409
ext4_xattr_set+0x22a/0x320 fs/ext4/xattr.c:2522
__vfs_setxattr+0x3e0/0x420 fs/xattr.c:182
__vfs_setxattr_noperm+0x129/0x5e0 fs/xattr.c:216
vfs_setxattr+0x168/0x2f0 fs/xattr.c:303
do_setxattr fs/xattr.c:588 [inline]
setxattr+0x2da/0x300 fs/xattr.c:611
path_setxattr+0x142/0x280 fs/xattr.c:630
__do_sys_setxattr fs/xattr.c:646 [inline]
__se_sys_setxattr fs/xattr.c:642 [inline]
__x64_sys_setxattr+0xb7/0xd0 fs/xattr.c:642
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
-> #0 (&sb->s_type->i_mutex_key#9/1){+.+.}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain kernel/locking/lockdep.c:3788 [inline]
__lock_acquire+0x2c33/0x7c60 kernel/locking/lockdep.c:5012
lock_acquire+0x197/0x3f0 kernel/locking/lockdep.c:5623
down_write+0x38/0x60 kernel/locking/rwsem.c:1551
inode_lock include/linux/fs.h:787 [inline]
ext4_xattr_inode_create fs/ext4/xattr.c:1474 [inline]
ext4_xattr_inode_lookup_create fs/ext4/xattr.c:1556 [inline]
ext4_xattr_set_entry+0x34fb/0x3d30 fs/ext4/xattr.c:1684
ext4_xattr_block_set+0x4f7/0x2d30 fs/ext4/xattr.c:1935
ext4_xattr_move_to_block fs/ext4/xattr.c:2632 [inline]
ext4_xattr_make_inode_space fs/ext4/xattr.c:2707 [inline]
ext4_expand_extra_isize_ea+0xf4b/0x19a0 fs/ext4/xattr.c:2799
__ext4_expand_extra_isize+0x301/0x3e0 fs/ext4/inode.c:5886
ext4_try_to_expand_extra_isize fs/ext4/inode.c:5929 [inline]
__ext4_mark_inode_dirty+0x469/0x700 fs/ext4/inode.c:6007
ext4_setattr+0x13b7/0x19e0 fs/ext4/inode.c:5548
notify_change+0xbcd/0xee0 fs/attr.c:505
do_truncate+0x197/0x220 fs/open.c:65
handle_truncate fs/namei.c:3265 [inline]
do_open fs/namei.c:3612 [inline]
path_openat+0x28af/0x2f30 fs/namei.c:3742
do_filp_open+0x1b3/0x3e0 fs/namei.c:3769
do_sys_openat2+0x142/0x4a0 fs/open.c:1253
do_sys_open fs/open.c:1269 [inline]
__do_sys_openat fs/open.c:1285 [inline]
__se_sys_openat fs/open.c:1280 [inline]
__x64_sys_openat+0x135/0x160 fs/open.c:1280
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&ei->i_data_sem/3);
lock(&sb->s_type->i_mutex_key#9/1);
lock(&ei->i_data_sem/3);
lock(&sb->s_type->i_mutex_key#9/1);
*** DEADLOCK ***
5 locks held by syz-executor202/4293:
#0: ffff888078124460 (sb_writers#5){.+.+}-{0:0}, at: mnt_want_write+0x3d/0x90 fs/namespace.c:377
#1: ffff8880716a5da8 (&sb->s_type->i_mutex_key#9){++++}-{3:3}, at: inode_lock include/linux/fs.h:787 [inline]
#1: ffff8880716a5da8 (&sb->s_type->i_mutex_key#9){++++}-{3:3}, at: do_truncate+0x183/0x220 fs/open.c:63
#2: ffff8880716a5f48 (mapping.invalidate_lock){++++}-{3:3}, at: filemap_invalidate_lock include/linux/fs.h:832 [inline]
#2: ffff8880716a5f48 (mapping.invalidate_lock){++++}-{3:3}, at: ext4_setattr+0xdb6/0x19e0 fs/ext4/inode.c:5505
#3: ffff8880716a5c30 (&ei->i_data_sem/3){++++}-{3:3}, at: ext4_setattr+0x133d/0x19e0 fs/ext4/inode.c:5545
#4: ffff8880716a5a80 (&ei->xattr_sem){++++}-{3:3}, at: ext4_write_trylock_xattr fs/ext4/xattr.h:162 [inline]
#4: ffff8880716a5a80 (&ei->xattr_sem){++++}-{3:3}, at: ext4_try_to_expand_extra_isize fs/ext4/inode.c:5926 [inline]
#4: ffff8880716a5a80 (&ei->xattr_sem){++++}-{3:3}, at: __ext4_mark_inode_dirty+0x3e8/0x700 fs/ext4/inode.c:6007
stack backtrace:
CPU: 0 PID: 4293 Comm: syz-executor202 Not tainted 5.15.184-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
<TASK>
dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106
check_noncircular+0x274/0x310 kernel/locking/lockdep.c:2133
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain kernel/locking/lockdep.c:3788 [inline]
__lock_acquire+0x2c33/0x7c60 kernel/locking/lockdep.c:5012
lock_acquire+0x197/0x3f0 kernel/locking/lockdep.c:5623
down_write+0x38/0x60 kernel/locking/rwsem.c:1551
inode_lock include/linux/fs.h:787 [inline]
ext4_xattr_inode_create fs/ext4/xattr.c:1474 [inline]
ext4_xattr_inode_lookup_create fs/ext4/xattr.c:1556 [inline]
ext4_xattr_set_entry+0x34fb/0x3d30 fs/ext4/xattr.c:1684
ext4_xattr_block_set+0x4f7/0x2d30 fs/ext4/xattr.c:1935
ext4_xattr_move_to_block fs/ext4/xattr.c:2632 [inline]
ext4_xattr_make_inode_space fs/ext4/xattr.c:2707 [inline]
ext4_expand_extra_isize_ea+0xf4b/0x19a0 fs/ext4/xattr.c:2799
__ext4_expand_extra_isize+0x301/0x3e0 fs/ext4/inode.c:5886
ext4_try_to_expand_extra_isize fs/ext4/inode.c:5929 [inline]
__ext4_mark_inode_dirty+0x469/0x700 fs/ext4/inode.c:6007
ext4_setattr+0x13b7/0x19e0 fs/ext4/inode.c:5548
notify_change+0xbcd/0xee0 fs/attr.c:505
do_truncate+0x197/0x220 fs/open.c:65
handle_truncate fs/namei.c:3265 [inline]
do_open fs/namei.c:3612 [inline]
path_openat+0x28af/0x2f30 fs/namei.c:3742
do_filp_open+0x1b3/0x3e0 fs/namei.c:3769
do_sys_openat2+0x142/0x4a0 fs/open.c:1253
do_sys_open fs/open.c:1269 [inline]
__do_sys_openat fs/open.c:1285 [inline]
__se_sys_openat fs/open.c:1280 [inline]
__x64_sys_openat+0x135/0x160 fs/open.c:1280
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f08822cf2e9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 21 18 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:00007ffdd38036a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 0000200000000040 RCX: 00007f08822cf2e9
RDX: 0000000000000242 RSI: 0000200000000040 RDI: 00000000ffffff9c
RBP: 0031656c69662f2e R08: 00007ffdd38036e0 R09: 00007ffdd38036e0
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffdd38036cc
R13: 0000000000000039 R14: 431bde82d7b634db R15: 00007ffdd3803700
</TASK>