loop4: detected capacity change from 0 to 32768
JBD2: Ignoring recovery information on journal
ocfs2: Mounting device (7,4) on (node local, slot 0) with ordered data mode.
======================================================
WARNING: possible circular locking dependency detected
6.14.0-rc4-syzkaller-00052-gac9c34d1e45a #0 Not tainted
------------------------------------------------------
syz.4.202/7760 is trying to acquire lock:
ffff8880260b6898 (&new->rf_sem){+.+.}-{4:4}, at: __ocfs2_lock_refcount_tree fs/ocfs2/refcounttree.c:428 [inline]
ffff8880260b6898 (&new->rf_sem){+.+.}-{4:4}, at: ocfs2_lock_refcount_tree+0x1fe/0xa70 fs/ocfs2/refcounttree.c:463
but task is already holding lock:
ffff888053fa0660 (&ocfs2_quota_ip_alloc_sem_key){++++}-{4:4}, at: ocfs2_inode_lock_for_extent_tree+0x6d/0x180 fs/ocfs2/file.c:2208
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #6 (&ocfs2_quota_ip_alloc_sem_key){++++}-{4:4}:
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5851
down_write+0x99/0x220 kernel/locking/rwsem.c:1577
ocfs2_lock_global_qf+0x225/0x2b0 fs/ocfs2/quota_global.c:314
ocfs2_acquire_dquot+0x2b0/0xb70 fs/ocfs2/quota_global.c:828
dqget+0x770/0xeb0 fs/quota/dquot.c:977
__dquot_initialize+0x2e3/0xec0 fs/quota/dquot.c:1505
ocfs2_get_init_inode+0x158/0x1d0 fs/ocfs2/namei.c:202
ocfs2_mknod+0xcfa/0x2b30 fs/ocfs2/namei.c:310
ocfs2_create+0x1ab/0x470 fs/ocfs2/namei.c:673
lookup_open fs/namei.c:3651 [inline]
open_last_lookups fs/namei.c:3750 [inline]
path_openat+0x193c/0x3590 fs/namei.c:3986
do_filp_open+0x27f/0x4e0 fs/namei.c:4016
do_sys_openat2+0x13e/0x1d0 fs/open.c:1428
do_sys_open fs/open.c:1443 [inline]
__do_sys_open fs/open.c:1451 [inline]
__se_sys_open fs/open.c:1447 [inline]
__x64_sys_open+0x225/0x270 fs/open.c:1447
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #5 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#7){+.+.}-{4:4}:
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5851
down_write+0x99/0x220 kernel/locking/rwsem.c:1577
inode_lock include/linux/fs.h:877 [inline]
ocfs2_lock_global_qf+0x206/0x2b0 fs/ocfs2/quota_global.c:313
ocfs2_acquire_dquot+0x2b0/0xb70 fs/ocfs2/quota_global.c:828
dqget+0x770/0xeb0 fs/quota/dquot.c:977
__dquot_initialize+0x2e3/0xec0 fs/quota/dquot.c:1505
ocfs2_get_init_inode+0x158/0x1d0 fs/ocfs2/namei.c:202
ocfs2_mknod+0xcfa/0x2b30 fs/ocfs2/namei.c:310
ocfs2_create+0x1ab/0x470 fs/ocfs2/namei.c:673
lookup_open fs/namei.c:3651 [inline]
open_last_lookups fs/namei.c:3750 [inline]
path_openat+0x193c/0x3590 fs/namei.c:3986
do_filp_open+0x27f/0x4e0 fs/namei.c:4016
do_sys_openat2+0x13e/0x1d0 fs/open.c:1428
do_sys_open fs/open.c:1443 [inline]
__do_sys_open fs/open.c:1451 [inline]
__se_sys_open fs/open.c:1447 [inline]
__x64_sys_open+0x225/0x270 fs/open.c:1447
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #4 (&dquot->dq_lock){+.+.}-{4:4}:
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5851
__mutex_lock_common kernel/locking/mutex.c:585 [inline]
__mutex_lock+0x19c/0x1010 kernel/locking/mutex.c:730
wait_on_dquot fs/quota/dquot.c:354 [inline]
dqget+0x6e6/0xeb0 fs/quota/dquot.c:972
dquot_transfer+0x482/0x6d0 fs/quota/dquot.c:2154
ext4_setattr+0xb49/0x1da0 fs/ext4/inode.c:5401
notify_change+0xbca/0xe90 fs/attr.c:552
chown_common+0x501/0x850 fs/open.c:782
do_fchownat+0x16a/0x240 fs/open.c:813
__do_sys_chown fs/open.c:833 [inline]
__se_sys_chown fs/open.c:831 [inline]
__x64_sys_chown+0x82/0x90 fs/open.c:831
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #3 (&ei->xattr_sem){++++}-{4:4}:
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5851
down_write+0x99/0x220 kernel/locking/rwsem.c:1577
ext4_write_lock_xattr fs/ext4/xattr.h:154 [inline]
ext4_xattr_set_handle+0x277/0x1580 fs/ext4/xattr.c:2373
ext4_initxattrs+0xa3/0x120 fs/ext4/xattr_security.c:44
security_inode_init_security+0x29c/0x480 security/security.c:1852
__ext4_new_inode+0x388f/0x4630 fs/ext4/ialloc.c:1324
ext4_create+0x279/0x550 fs/ext4/namei.c:2841
lookup_open fs/namei.c:3651 [inline]
open_last_lookups fs/namei.c:3750 [inline]
path_openat+0x193c/0x3590 fs/namei.c:3986
do_filp_open+0x27f/0x4e0 fs/namei.c:4016
do_sys_openat2+0x13e/0x1d0 fs/open.c:1428
do_sys_open fs/open.c:1443 [inline]
__do_sys_openat fs/open.c:1459 [inline]
__se_sys_openat fs/open.c:1454 [inline]
__x64_sys_openat+0x247/0x2a0 fs/open.c:1454
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #2 (jbd2_handle){++++}-{0:0}:
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5851
jbd2_journal_lock_updates+0xaa/0x380 fs/jbd2/transaction.c:865
__ocfs2_flush_truncate_log+0x2ea/0x1240 fs/ocfs2/alloc.c:6029
ocfs2_flush_truncate_log+0x4f/0x70 fs/ocfs2/alloc.c:6076
ocfs2_sync_fs+0x125/0x390 fs/ocfs2/super.c:406
iterate_supers+0xc6/0x190 fs/super.c:934
ksys_sync+0xdb/0x1c0 fs/sync.c:104
__do_sys_sync+0xe/0x20 fs/sync.c:113
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #1 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#5){+.+.}-{4:4}:
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5851
down_write+0x99/0x220 kernel/locking/rwsem.c:1577
inode_lock include/linux/fs.h:877 [inline]
ocfs2_remove_btree_range+0x737/0x1860 fs/ocfs2/alloc.c:5742
ocfs2_commit_truncate+0xcca/0x2550 fs/ocfs2/alloc.c:7364
ocfs2_truncate_file+0xd21/0x1560 fs/ocfs2/file.c:509
ocfs2_setattr+0x1890/0x1ef0 fs/ocfs2/file.c:1212
notify_change+0xbca/0xe90 fs/attr.c:552
do_truncate+0x220/0x310 fs/open.c:65
vfs_truncate+0x492/0x530 fs/open.c:115
do_sys_truncate+0xdb/0x190 fs/open.c:138
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #0 (&new->rf_sem){+.+.}-{4:4}:
check_prev_add kernel/locking/lockdep.c:3163 [inline]
check_prevs_add kernel/locking/lockdep.c:3282 [inline]
validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3906
__lock_acquire+0x1397/0x2100 kernel/locking/lockdep.c:5228
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5851
down_write+0x99/0x220 kernel/locking/rwsem.c:1577
__ocfs2_lock_refcount_tree fs/ocfs2/refcounttree.c:428 [inline]
ocfs2_lock_refcount_tree+0x1fe/0xa70 fs/ocfs2/refcounttree.c:463
ocfs2_refcount_cow_hunk fs/ocfs2/refcounttree.c:3406 [inline]
ocfs2_refcount_cow+0x763/0x11a0 fs/ocfs2/refcounttree.c:3467
ocfs2_prepare_inode_for_write fs/ocfs2/file.c:2340 [inline]
ocfs2_file_write_iter+0x10ba/0x2180 fs/ocfs2/file.c:2451
new_sync_write fs/read_write.c:586 [inline]
vfs_write+0xacf/0xd10 fs/read_write.c:679
ksys_write+0x18f/0x2b0 fs/read_write.c:731
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
other info that might help us debug this:
Chain exists of:
&new->rf_sem --> &ocfs2_sysfile_lock_key[args->fi_sysfile_type]#7 --> &ocfs2_quota_ip_alloc_sem_key
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&ocfs2_quota_ip_alloc_sem_key);
lock(&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#7);
lock(&ocfs2_quota_ip_alloc_sem_key);
lock(&new->rf_sem);
*** DEADLOCK ***
4 locks held by syz.4.202/7760:
#0: ffff8880277f75f8 (&f->f_pos_lock){+.+.}-{4:4}, at: fdget_pos+0x254/0x320 fs/file.c:1192
#1: ffff88807dde0420 (sb_writers#16){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:3035 [inline]
#1: ffff88807dde0420 (sb_writers#16){.+.+}-{0:0}, at: vfs_write+0x225/0xd10 fs/read_write.c:675
#2: ffff888053fa09c0 (&sb->s_type->i_mutex_key#30){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:877 [inline]
#2: ffff888053fa09c0 (&sb->s_type->i_mutex_key#30){+.+.}-{4:4}, at: ocfs2_file_write_iter+0x445/0x2180 fs/ocfs2/file.c:2399
#3: ffff888053fa0660 (&ocfs2_quota_ip_alloc_sem_key){++++}-{4:4}, at: ocfs2_inode_lock_for_extent_tree+0x6d/0x180 fs/ocfs2/file.c:2208
stack backtrace:
CPU: 0 UID: 0 PID: 7760 Comm: syz.4.202 Not tainted 6.14.0-rc4-syzkaller-00052-gac9c34d1e45a #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
print_circular_bug+0x13a/0x1b0 kernel/locking/lockdep.c:2076
check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2208
check_prev_add kernel/locking/lockdep.c:3163 [inline]
check_prevs_add kernel/locking/lockdep.c:3282 [inline]
validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3906
__lock_acquire+0x1397/0x2100 kernel/locking/lockdep.c:5228
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5851
down_write+0x99/0x220 kernel/locking/rwsem.c:1577
__ocfs2_lock_refcount_tree fs/ocfs2/refcounttree.c:428 [inline]
ocfs2_lock_refcount_tree+0x1fe/0xa70 fs/ocfs2/refcounttree.c:463
ocfs2_refcount_cow_hunk fs/ocfs2/refcounttree.c:3406 [inline]
ocfs2_refcount_cow+0x763/0x11a0 fs/ocfs2/refcounttree.c:3467
ocfs2_prepare_inode_for_write fs/ocfs2/file.c:2340 [inline]
ocfs2_file_write_iter+0x10ba/0x2180 fs/ocfs2/file.c:2451
new_sync_write fs/read_write.c:586 [inline]
vfs_write+0xacf/0xd10 fs/read_write.c:679
ksys_write+0x18f/0x2b0 fs/read_write.c:731
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f050138d169
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f0502179038 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f05015a5fa0 RCX: 00007f050138d169
RDX: 000000000000000f RSI: 0000400000000180 RDI: 0000000000000004
RBP: 00007f050140e2a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f05015a5fa0 R15: 00007fffb747e668
</TASK>