======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Tainted: G             L     
------------------------------------------------------
syz.6.1035/10226 is trying to acquire lock:
ffff8881a09edd60 (&ocfs2_file_ip_alloc_sem_key){++++}-{4:4}, at: ocfs2_try_remove_refcount_tree+0xb6/0x340

but task is already holding lock:
ffff8881a09eddf8 (&oi->ip_xattr_sem){++++}-{4:4}, at: ocfs2_try_remove_refcount_tree+0xa4/0x340

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&oi->ip_xattr_sem){++++}-{4:4}:
       down_read+0x47/0x2e0
       ocfs2_init_acl+0x2fd/0x7e0
       ocfs2_mknod+0x1423/0x2210
       ocfs2_mkdir+0x181/0x430
       vfs_mkdir+0x753/0x870
       do_mkdirat+0x27d/0x4b0
       __x64_sys_mkdirat+0x87/0xa0
       do_syscall_64+0xe2/0xf80
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #2 (&journal->j_trans_barrier){.+.+}-{4:4}:
       down_read+0x47/0x2e0
       ocfs2_start_trans+0x3ab/0x700
       ocfs2_reserve_suballoc_bits+0x7bb/0x4790
       ocfs2_reserve_new_metadata_blocks+0x415/0x9a0
       ocfs2_extend_dir+0xcc9/0x49b0
       ocfs2_prepare_dir_for_insert+0x3452/0x52c0
       ocfs2_mknod+0x823/0x2210
       ocfs2_mkdir+0x181/0x430
       vfs_mkdir+0x753/0x870
       do_mkdirat+0x27d/0x4b0
       __x64_sys_mkdirat+0x87/0xa0
       do_syscall_64+0xe2/0xf80
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #1 (sb_internal#6){.+.+}-{0:0}:
       ocfs2_start_trans+0x2ac/0x700
       ocfs2_truncate_file+0x631/0x1480
       ocfs2_setattr+0x15e5/0x1c70
       notify_change+0xc1a/0xf40
       do_truncate+0x1c2/0x250
       vfs_coredump+0x3712/0x4270
       get_signal+0x1107/0x1330
       arch_do_signal_or_restart+0xbc/0x830
       irqentry_exit+0x176/0x620
       asm_exc_page_fault+0x26/0x30

-> #0 (&ocfs2_file_ip_alloc_sem_key){++++}-{4:4}:
       __lock_acquire+0x15a5/0x2cf0
       lock_acquire+0x106/0x330
       down_write+0x96/0x200
       ocfs2_try_remove_refcount_tree+0xb6/0x340
       ocfs2_truncate_file+0xdf3/0x1480
       ocfs2_setattr+0x15e5/0x1c70
       notify_change+0xc1a/0xf40
       do_truncate+0x1c2/0x250
       vfs_coredump+0x3712/0x4270
       get_signal+0x1107/0x1330
       arch_do_signal_or_restart+0xbc/0x830
       irqentry_exit+0x176/0x620
       asm_exc_page_fault+0x26/0x30

other info that might help us debug this:

Chain exists of:
  &ocfs2_file_ip_alloc_sem_key --> &journal->j_trans_barrier --> &oi->ip_xattr_sem

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&oi->ip_xattr_sem);
                               lock(&journal->j_trans_barrier);
                               lock(&oi->ip_xattr_sem);
  lock(&ocfs2_file_ip_alloc_sem_key);

 *** DEADLOCK ***

2 locks held by syz.6.1035/10226:
 #0: ffff8881a09ee0c0 (&sb->s_type->i_mutex_key#39){+.+.}-{4:4}, at: do_truncate+0x18f/0x250
 #1: ffff8881a09eddf8 (&oi->ip_xattr_sem){++++}-{4:4}, at: ocfs2_try_remove_refcount_tree+0xa4/0x340

stack backtrace:
CPU: 0 UID: 0 PID: 10226 Comm: syz.6.1035 Tainted: G             L      syzkaller #0 PREEMPT(full) 
Tainted: [L]=SOFTLOCKUP
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150
 print_circular_bug+0x2e1/0x300
 check_noncircular+0x12e/0x150
 __lock_acquire+0x15a5/0x2cf0
 lock_acquire+0x106/0x330
 down_write+0x96/0x200
 ocfs2_try_remove_refcount_tree+0xb6/0x340
 ocfs2_truncate_file+0xdf3/0x1480
 ocfs2_setattr+0x15e5/0x1c70
 notify_change+0xc1a/0xf40
 do_truncate+0x1c2/0x250
 vfs_coredump+0x3712/0x4270
 get_signal+0x1107/0x1330
 arch_do_signal_or_restart+0xbc/0x830
 irqentry_exit+0x176/0x620
 asm_exc_page_fault+0x26/0x30
RIP: 0033:0x7fd96819c7a1
Code: 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f
RSP: 002b:fffffffffffffe70 EFLAGS: 00010217
RAX: 0000000000000000 RBX: 00007fd968415fa0 RCX: 00007fd96819c799
RDX: 0000000000000000 RSI: fffffffffffffe70 RDI: 0000000000008000
RBP: 00007fd968232bd9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000000
R13: 00007fd968416038 R14: 00007fd968415fa0 R15: 00007ffc8f4f7098
 </TASK>
OCFS2: ERROR (device loop6): int ocfs2_validate_gd_parent(struct super_block *, struct ocfs2_dinode *, struct buffer_head *, int): Group descriptor #32 has bit count of 1024
On-disk corruption discovered. Please run fsck.ocfs2 once the filesystem is unmounted.
OCFS2: File system is now read-only.
(syz.6.1035,10226,0):ocfs2_search_chain:1818 ERROR: status = -30
(syz.6.1035,10226,0):ocfs2_search_chain:1941 ERROR: status = -30
(syz.6.1035,10226,0):ocfs2_claim_suballoc_bits:2021 ERROR: status = -30
(syz.6.1035,10226,0):ocfs2_claim_suballoc_bits:2074 ERROR: status = -30
(syz.6.1035,10226,0):__ocfs2_claim_clusters:2449 ERROR: status = -30
(syz.6.1035,10226,0):__ocfs2_claim_clusters:2457 ERROR: status = -30
(syz.6.1035,10226,0):ocfs2_local_alloc_new_window:1199 ERROR: status = -30
(syz.6.1035,10226,0):ocfs2_local_alloc_new_window:1224 ERROR: status = -30
(syz.6.1035,10226,0):ocfs2_local_alloc_slide_window:1298 ERROR: status = -30
(syz.6.1035,10226,0):ocfs2_local_alloc_slide_window:1317 ERROR: status = -30
(syz.6.1035,10226,1):ocfs2_reserve_local_alloc_bits:672 ERROR: status = -30
(syz.6.1035,10226,1):ocfs2_reserve_local_alloc_bits:710 ERROR: status = -30
(syz.6.1035,10226,1):ocfs2_reserve_clusters_with_limit:1173 ERROR: status = -30
(syz.6.1035,10226,1):ocfs2_reserve_clusters_with_limit:1222 ERROR: status = -30
(syz.6.1035,10226,1):ocfs2_convert_inline_data_to_extents:7101 ERROR: status = -30
(syz.6.1035,10226,1):ocfs2_try_to_write_inline_data:1544 ERROR: status = -30
(syz.6.1035,10226,1):ocfs2_write_begin_nolock:1656 ERROR: status = -30
(syz.6.1035,10226,1):ocfs2_write_begin:1887 ERROR: status = -30
syz.6.1035 (10226) used greatest stack depth: 16456 bytes left
