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

but task is already holding lock:
ffff8881a40a4ce8 (&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+0x1679/0x2260
       ocfs2_create+0x195/0x460
       path_openat+0x1395/0x3860
       do_file_open+0x23e/0x4a0
       do_sys_openat2+0x113/0x200
       __x64_sys_openat+0x138/0x170
       do_syscall_64+0x15f/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_setattr+0x110a/0x1ca0
       notify_change+0xc1a/0xf40
       chown_common+0x466/0x6b0
       ksys_fchown+0xe9/0x160
       __x64_sys_fchown+0x7a/0x90
       do_syscall_64+0x15f/0xf80
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #1 (sb_internal#3){.+.+}-{0:0}:
       ocfs2_start_trans+0x2ac/0x700
       ocfs2_setattr+0x110a/0x1ca0
       notify_change+0xc1a/0xf40
       chown_common+0x466/0x6b0
       ksys_fchown+0xe9/0x160
       __x64_sys_fchown+0x7a/0x90
       do_syscall_64+0x15f/0xf80
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (&ocfs2_file_ip_alloc_sem_key){++++}-{4:4}:
       __lock_acquire+0x15a5/0x2cf0
       lock_acquire+0x106/0x350
       down_write+0x96/0x200
       ocfs2_try_remove_refcount_tree+0xb6/0x340
       ocfs2_truncate_file+0xdf3/0x14e0
       ocfs2_setattr+0x15e5/0x1ca0
       notify_change+0xc1a/0xf40
       do_truncate+0x1c2/0x250
       vfs_coredump+0x387b/0x4530
       get_signal+0x1107/0x1330
       arch_do_signal_or_restart+0xbc/0x830
       irqentry_exit+0x284/0x730
       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.4.1188/10078:
 #0: ffff8881a40a4fa0 (&sb->s_type->i_mutex_key#34){+.+.}-{4:4}, at: do_truncate+0x18f/0x250
 #1: ffff8881a40a4ce8 (&oi->ip_xattr_sem){++++}-{4:4}, at: ocfs2_try_remove_refcount_tree+0xa4/0x340

stack backtrace:
CPU: 1 UID: 0 PID: 10078 Comm: syz.4.1188 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/0x350
 down_write+0x96/0x200
 ocfs2_try_remove_refcount_tree+0xb6/0x340
 ocfs2_truncate_file+0xdf3/0x14e0
 ocfs2_setattr+0x15e5/0x1ca0
 notify_change+0xc1a/0xf40
 do_truncate+0x1c2/0x250
 vfs_coredump+0x387b/0x4530
 get_signal+0x1107/0x1330
 arch_do_signal_or_restart+0xbc/0x830
 irqentry_exit+0x284/0x730
 asm_exc_page_fault+0x26/0x30
RIP: 0033:0x7f0c58a52877
Code: e8 8e fa ff ff 89 f2 48 8d 3d 0d 40 1b 00 48 8d 35 c4 fa 1d 00 31 c0 e8 e7 f8 ff ff 0f 1f 80 00 00 00 00 53 89 fb 48 83 ec 10 <64> 8b 04 25 a4 ff ff ff 85 c0 74 2a 89 fe 31 c0 bf 3c 00 00 00 e8
RSP: 002b:00007f0c59af20a0 EFLAGS: 00010206
RAX: 0000000000000000 RBX: 000000000000000b RCX: 00007f0c58b9cdd9
RDX: 00007f0c59af20c0 RSI: 00007f0c59af21f0 RDI: 000000000000000b
RBP: 00007f0c58c32d69 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000000
R13: 00007f0c58e16038 R14: 00007f0c58e15fa0 R15: 00007ffcfb0b37b8
 </TASK>
OCFS2: ERROR (device loop4): int ocfs2_validate_gd_self(struct super_block *, struct buffer_head *, int): Group descriptor #20 has bad signature 
On-disk corruption discovered. Please run fsck.ocfs2 once the filesystem is unmounted.
OCFS2: File system is now read-only.
(syz.4.1188,10078,0):ocfs2_search_chain:1913 ERROR: status = -30
(syz.4.1188,10078,0):ocfs2_search_chain:2036 ERROR: status = -30
(syz.4.1188,10078,0):ocfs2_claim_suballoc_bits:2123 ERROR: status = -30
(syz.4.1188,10078,0):ocfs2_claim_suballoc_bits:2176 ERROR: status = -30
(syz.4.1188,10078,0):ocfs2_claim_metadata:2201 ERROR: status = -30
(syz.4.1188,10078,0):ocfs2_claim_metadata:2214 ERROR: status = -30
(syz.4.1188,10078,0):ocfs2_create_new_meta_bhs:1038 ERROR: status = -30
(syz.4.1188,10078,0):ocfs2_shift_tree_depth:1400 ERROR: status = -30
(syz.4.1188,10078,0):ocfs2_grow_tree:1583 ERROR: status = -30
(syz.4.1188,10078,0):ocfs2_insert_extent:4768 ERROR: status = -30
(syz.4.1188,10078,0):ocfs2_add_clusters_in_btree:4869 ERROR: status = -30
(syz.4.1188,10078,0):ocfs2_extend_allocation:643 ERROR: status = -30
(syz.4.1188,10078,0):ocfs2_extend_no_holes:1031 ERROR: status = -30
(syz.4.1188,10078,0):ocfs2_expand_nonsparse_inode:1603 ERROR: status = -30
(syz.4.1188,10078,0):ocfs2_write_begin_nolock:1670 ERROR: status = -30
(syz.4.1188,10078,0):ocfs2_write_begin:1888 ERROR: status = -30
syz.4.1188 (10078) used greatest stack depth: 14856 bytes left
