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
syzkaller #0 Not tainted
------------------------------------------------------
syz.4.565/8935 is trying to acquire lock:
ffff8881b2a64f78 (&oi->ip_xattr_sem){++++}-{4:4}, at: ocfs2_calc_xattr_init+0x20a/0xd80

but task is already holding lock:
ffff8881a65e26c0 (&ocfs2_sysfile_lock_key[INODE_ALLOC_SYSTEM_INODE]){+.+.}-{4:4}, at: ocfs2_reserve_suballoc_bits+0x168/0x4730

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&ocfs2_sysfile_lock_key[INODE_ALLOC_SYSTEM_INODE]){+.+.}-{4:4}:
       lock_acquire+0x120/0x360
       down_write+0x96/0x1f0
       ocfs2_evict_inode+0x153d/0x4100
       evict+0x504/0x9c0
       ocfs2_dentry_iput+0x247/0x370
       __dentry_kill+0x209/0x660
       dput+0x19f/0x2b0
       __fput+0x68e/0xa70
       task_work_run+0x1d4/0x260
       exit_to_user_mode_loop+0xe9/0x130
       do_syscall_64+0x2bd/0xfa0
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #2 (&ocfs2_sysfile_lock_key[ORPHAN_DIR_SYSTEM_INODE]){+.+.}-{4:4}:
       lock_acquire+0x120/0x360
       down_write+0x96/0x1f0
       ocfs2_del_inode_from_orphan+0x134/0x740
       ocfs2_dio_end_io+0x479/0x10f0
       dio_complete+0x25b/0x790
       __blockdev_direct_IO+0x2e63/0x3490
       ocfs2_direct_IO+0x25f/0x2d0
       generic_file_direct_write+0x1db/0x3e0
       __generic_file_write_iter+0x11d/0x230
       ocfs2_file_write_iter+0x157a/0x1d10
       do_iter_readv_writev+0x623/0x8c0
       vfs_writev+0x31a/0x960
       __se_sys_pwritev2+0x179/0x290
       do_syscall_64+0xfa/0xfa0
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #1 (&oi->ip_alloc_sem){++++}-{4:4}:
       lock_acquire+0x120/0x360
       down_write+0x96/0x1f0
       ocfs2_try_remove_refcount_tree+0xb6/0x320
       ocfs2_truncate_file+0xda0/0x1420
       ocfs2_setattr+0x1520/0x1b40
       notify_change+0xc1a/0xf40
       do_truncate+0x1a4/0x220
       path_openat+0x306c/0x3830
       do_filp_open+0x1fa/0x410
       do_sys_openat2+0x121/0x1c0
       __x64_sys_openat+0x138/0x170
       do_syscall_64+0xfa/0xfa0
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (&oi->ip_xattr_sem){++++}-{4:4}:
       validate_chain+0xb9b/0x2140
       __lock_acquire+0xab9/0xd20
       lock_acquire+0x120/0x360
       down_read+0x46/0x2e0
       ocfs2_calc_xattr_init+0x20a/0xd80
       ocfs2_mknod+0xc92/0x2050
       ocfs2_create+0x1a5/0x440
       path_openat+0x14f4/0x3830
       do_filp_open+0x1fa/0x410
       do_sys_openat2+0x121/0x1c0
       __x64_sys_openat+0x138/0x170
       do_syscall_64+0xfa/0xfa0
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

Chain exists of:
  &oi->ip_xattr_sem --> &ocfs2_sysfile_lock_key[ORPHAN_DIR_SYSTEM_INODE] --> &ocfs2_sysfile_lock_key[INODE_ALLOC_SYSTEM_INODE]

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&ocfs2_sysfile_lock_key[INODE_ALLOC_SYSTEM_INODE]);
                               lock(&ocfs2_sysfile_lock_key[ORPHAN_DIR_SYSTEM_INODE]);
                               lock(&ocfs2_sysfile_lock_key[INODE_ALLOC_SYSTEM_INODE]);
  rlock(&oi->ip_xattr_sem);

 *** DEADLOCK ***

3 locks held by syz.4.565/8935:
 #0: ffff8881b51d0420 (sb_writers#12){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90
 #1: ffff8881b2a65240 (&type->i_mutex_dir_key#8){++++}-{4:4}, at: path_openat+0x8da/0x3830
 #2: ffff8881a65e26c0 (&ocfs2_sysfile_lock_key[INODE_ALLOC_SYSTEM_INODE]){+.+.}-{4:4}, at: ocfs2_reserve_suballoc_bits+0x168/0x4730

stack backtrace:
CPU: 1 UID: 0 PID: 8935 Comm: syz.4.565 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+0x189/0x250
 print_circular_bug+0x2ee/0x310
 check_noncircular+0x134/0x160
 validate_chain+0xb9b/0x2140
 __lock_acquire+0xab9/0xd20
 lock_acquire+0x120/0x360
 down_read+0x46/0x2e0
 ocfs2_calc_xattr_init+0x20a/0xd80
 ocfs2_mknod+0xc92/0x2050
 ocfs2_create+0x1a5/0x440
 path_openat+0x14f4/0x3830
 do_filp_open+0x1fa/0x410
 do_sys_openat2+0x121/0x1c0
 __x64_sys_openat+0x138/0x170
 do_syscall_64+0xfa/0xfa0
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f00fcb8efc9
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:00007f00fd9a5038 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f00fcde5fa0 RCX: 00007f00fcb8efc9
RDX: 0000000000000441 RSI: 00002000000000c0 RDI: ffffffffffffff9c
RBP: 00007f00fcc11f91 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000108 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f00fcde6038 R14: 00007f00fcde5fa0 R15: 00007ffee3b97c18
 </TASK>
OCFS2: ERROR (device loop4): int ocfs2_validate_gd_self(struct super_block *, struct buffer_head *, int): Group descriptor #1792 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.565,8935,1):ocfs2_search_chain:1857 ERROR: status = -30
(syz.4.565,8935,1):ocfs2_search_chain:1945 ERROR: status = -30
(syz.4.565,8935,1):ocfs2_claim_suballoc_bits:2015 ERROR: status = -30
(syz.4.565,8935,1):ocfs2_claim_suballoc_bits:2068 ERROR: status = -30
(syz.4.565,8935,1):ocfs2_claim_new_inode:2303 ERROR: status = -30
(syz.4.565,8935,1):ocfs2_claim_new_inode:2318 ERROR: status = -30
(syz.4.565,8935,1):ocfs2_mknod_locked:641 ERROR: status = -30
(syz.4.565,8935,1):ocfs2_mknod:388 ERROR: status = -30
(syz.4.565,8935,0):ocfs2_mknod:505 ERROR: status = -30
(syz.4.565,8935,0):ocfs2_create:678 ERROR: status = -30
