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

but task is already holding lock:
ffff8880220c4f78 (&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_shutdown_local_alloc+0x1fb/0xab0
       ocfs2_dismount_volume+0x1ec/0x8c0
       generic_shutdown_super+0x135/0x2c0
       kill_block_super+0x44/0x90
       deactivate_locked_super+0xbc/0x130
       cleanup_mnt+0x437/0x4d0
       task_work_run+0x1d9/0x270
       exit_to_user_mode_loop+0xed/0x480
       do_syscall_64+0x2b7/0xf80
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #1 (sb_internal#5){.+.+}-{0:0}:
       lock_release+0x199/0x3a0
       up_write+0x2d/0x410
       ocfs2_free_alloc_context+0x97/0x1a0
       ocfs2_write_begin_nolock+0x40b8/0x4140
       ocfs2_write_begin+0x1c5/0x320
       generic_perform_write+0x2e2/0x8f0
       ocfs2_file_write_iter+0x1663/0x1e20
       vfs_write+0x61d/0xb90
       ksys_write+0x150/0x270
       do_syscall_64+0xe2/0xf80
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #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.3.5759/3963:
 #0: ffff8880220c5240 (&sb->s_type->i_mutex_key#42){+.+.}-{4:4}, at: do_truncate+0x18f/0x250
 #1: ffff8880220c4f78 (&oi->ip_xattr_sem){++++}-{4:4}, at: ocfs2_try_remove_refcount_tree+0xa4/0x340

stack backtrace:
CPU: 0 UID: 0 PID: 3963 Comm: syz.3.5759 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:0x7f817f6524f7
Code: e8 8e fa ff ff 89 f2 48 8d 3d 05 43 1b 00 48 8d 35 5f f9 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:00007f817d9b60a0 EFLAGS: 00010206
RAX: 0000000000000000 RBX: 000000000000000b RCX: 00007f817f79bf79
RDX: 00007f817d9b60c0 RSI: 00007f817d9b61f0 RDI: 000000000000000b
RBP: 00007f817f8327e0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000000
R13: 00007f817fa16128 R14: 00007f817fa16090 R15: 00007fffdede7828
 </TASK>
ocfs2: Unmounting device (7,3) on (node local)
