======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.3.122/6451 is trying to acquire lock:
ffff8881b97431e0 (&oi->ip_alloc_sem){+.+.}-{4:4}, at: ocfs2_try_remove_refcount_tree+0xb6/0x340

but task is already holding lock:
ffff8881b9743278 (&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:

-> #4 (&oi->ip_xattr_sem){++++}-{4:4}:
       lock_acquire+0x11f/0x350
       down_read+0x46/0x2e0
       ocfs2_init_acl+0x309/0x780
       ocfs2_mknod+0x1440/0x2230
       ocfs2_create+0x1a5/0x460
       path_openat+0x14fd/0x3890
       do_filp_open+0x22d/0x490
       filp_open+0x17f/0x1f0
       coredump_file+0x351/0xb40
       vfs_coredump+0x175b/0x2e70
       get_signal+0x1107/0x1330
       arch_do_signal_or_restart+0xc2/0x820
       irqentry_exit_to_user_mode+0x7d/0x110
       exc_general_protection+0x169/0x200
       asm_exc_general_protection+0x26/0x30

-> #3 (jbd2_handle){++++}-{0:0}:
       lock_acquire+0x11f/0x350
       start_this_handle+0x2074/0x2290
       jbd2__journal_start+0x2c0/0x5b0
       jbd2_journal_start+0x2a/0x40
       ocfs2_start_trans+0x3b7/0x700
       ocfs2_mknod+0xf4e/0x2230
       ocfs2_create+0x1a5/0x460
       path_openat+0x14fd/0x3890
       do_filp_open+0x22d/0x490
       filp_open+0x17f/0x1f0
       coredump_file+0x351/0xb40
       vfs_coredump+0x175b/0x2e70
       get_signal+0x1107/0x1330
       arch_do_signal_or_restart+0xc2/0x820
       irqentry_exit_to_user_mode+0x7d/0x110
       exc_general_protection+0x169/0x200
       asm_exc_general_protection+0x26/0x30

-> #2 (&journal->j_trans_barrier){.+.+}-{4:4}:
       lock_acquire+0x11f/0x350
       down_read+0x46/0x2e0
       ocfs2_start_trans+0x3ab/0x700
       ocfs2_mknod+0xf4e/0x2230
       ocfs2_create+0x1a5/0x460
       path_openat+0x14fd/0x3890
       do_filp_open+0x22d/0x490
       filp_open+0x17f/0x1f0
       coredump_file+0x351/0xb40
       vfs_coredump+0x175b/0x2e70
       get_signal+0x1107/0x1330
       arch_do_signal_or_restart+0xc2/0x820
       irqentry_exit_to_user_mode+0x7d/0x110
       exc_general_protection+0x169/0x200
       asm_exc_general_protection+0x26/0x30

-> #1 (
sb_internal#5){.+.+}-{0:0}:
       lock_acquire+0x11f/0x350
       ocfs2_start_trans+0x2ac/0x700
       ocfs2_truncate_file+0x663/0x14d0
       ocfs2_setattr+0x15a0/0x1be0
       notify_change+0xc1a/0xf40
       do_truncate+0x1c2/0x250
       coredump_file+0x7da/0xb40
       vfs_coredump+0x175b/0x2e70
       get_signal+0x1107/0x1330
       arch_do_signal_or_restart+0xc2/0x820
       irqentry_exit_to_user_mode+0x7d/0x110
       exc_general_protection+0x169/0x200
       asm_exc_general_protection+0x26/0x30

-> #0 (&oi->ip_alloc_sem){+.+.}-{4:4}:
       validate_chain+0xb9a/0x2130
       __lock_acquire+0xab8/0xd20
       lock_acquire+0x11f/0x350
       down_write+0x96/0x200
       ocfs2_try_remove_refcount_tree+0xb6/0x340
       ocfs2_truncate_file+0xe04/0x14d0
       ocfs2_setattr+0x15a0/0x1be0
       notify_change+0xc1a/0xf40
       do_truncate+0x1c2/0x250
       coredump_file+0x7da/0xb40
       vfs_coredump+0x175b/0x2e70
       get_signal+0x1107/0x1330
       arch_do_signal_or_restart+0xc2/0x820
       irqentry_exit_to_user_mode+0x7d/0x110
       exc_general_protection+0x169/0x200
       asm_exc_general_protection+0x26/0x30

other info that might help us debug this:

Chain exists of:
  &oi->ip_alloc_sem --> jbd2_handle --> &oi->ip_xattr_sem

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&oi->ip_xattr_sem);
                               lock(jbd2_handle);
                               lock(&oi->ip_xattr_sem);
  lock(&oi->ip_alloc_sem);

 *** DEADLOCK ***

2 locks held by syz.3.122/6451:
 #0: ffff8881b9743540 (&sb->s_type->i_mutex_key#27){+.+.}-{4:4}, at: do_truncate+0x18f/0x250
 #1: ffff8881b9743278 (&oi->ip_xattr_sem){++++}-{4:4}, at: ocfs2_try_remove_refcount_tree+0xa4/0x340

stack backtrace:
CPU: 1 UID: 0 PID: 6451 Comm: syz.3.122 Not tainted syzkaller #0 PREEMPT(full) 
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+0x1a9/0x280
 print_circular_bug+0x2ed/0x300
 check_noncircular+0x134/0x160
 validate_chain+0xb9a/0x2130
 __lock_acquire+0xab8/0xd20
 lock_acquire+0x11f/0x350
 down_write+0x96/0x200
 ocfs2_try_remove_refcount_tree+0xb6/0x340
 ocfs2_truncate_file+0xe04/0x14d0
 ocfs2_setattr+0x15a0/0x1be0
 notify_change+0xc1a/0xf40
 do_truncate+0x1c2/0x250
 coredump_file+0x7da/0xb40
 vfs_coredump+0x175b/0x2e70
 get_signal+0x1107/0x1330
 arch_do_signal_or_restart+0xc2/0x820
 irqentry_exit_to_user_mode+0x7d/0x110
 exc_general_protection+0x169/0x200
 asm_exc_general_protection+0x26/0x30
RIP: 0033:0x7fbd8599cde1
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:0000200000000250 EFLAGS: 00010217
RAX: 0000000000000000 RBX: 00007fbd85c15fa0 RCX: 00007fbd8599cdd9
RDX: 0000200000000280 RSI: 0000200000000250 RDI: 0000000000800000
RBP: 00007fbd85a32d69 R08: 0000200000000a40 R09: 0000200000000a40
R10: 00002000000002c0 R11: 0000000000000206 R12: 0000000000000000
R13: 00007fbd85c16038 R14: 00007fbd85c15fa0 R15: 00007ffed36124b8
 </TASK>
OCFS2: ERROR (device loop3): int ocfs2_claim_suballoc_bits(struct ocfs2_alloc_context *, handle_t *, u32, u32, struct ocfs2_suballoc_result *): Chain allocator dinode 71 has 16777215 used bits but only 1024 total
On-disk corruption discovered. Please run fsck.ocfs2 once the filesystem is unmounted.
(syz.3.122,6451,0):ocfs2_claim_suballoc_bits:2063 ERROR: status = -30
(syz.3.122,6451,0):__ocfs2_claim_clusters:2438 ERROR: status = -30
(syz.3.122,6451,0):__ocfs2_claim_clusters:2446 ERROR: status = -30
(syz.3.122,6451,0):ocfs2_convert_inline_data_to_extents:7135 ERROR: status = -30
(syz.3.122,6451,0):ocfs2_try_to_write_inline_data:1544 ERROR: status = -30
(syz.3.122,6451,0):ocfs2_write_begin_nolock:1656 ERROR: status = -30
(syz.3.122,6451,0):ocfs2_write_begin:1887 ERROR: status = -30
ocfs2: Unmounting device (7,3) on (node local)
