======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.6.436/9712 is trying to acquire lock:
ffff8881087694e0 (&ocfs2_file_ip_alloc_sem_key){++++}-{4:4}, at: ocfs2_page_mkwrite+0x2ff/0xc40

but task is already holding lock:
ffff8881228b8520 (sb_pagefaults#4){.+.+}-{0:0}, at: do_page_mkwrite+0x14d/0x310

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (sb_pagefaults#4){.+.+}-{0:0}:
       lock_acquire+0x120/0x360
       ocfs2_page_mkwrite+0x1da/0xc40
       do_page_mkwrite+0x14d/0x310
       __handle_mm_fault+0x1916/0x5440
       handle_mm_fault+0x40a/0x8e0
       do_user_addr_fault+0x764/0x1390
       exc_page_fault+0x76/0xf0
       asm_exc_page_fault+0x26/0x30
       rep_movs_alternative+0x54/0x90
       _copy_to_iter+0x24f/0x1790
       copy_page_to_iter+0x10c/0x1c0
       filemap_read+0x7c0/0x11a0
       ocfs2_file_read_iter+0x3fa/0xa80
       vfs_read+0x55a/0xa30
       ksys_read+0x145/0x250
       do_syscall_64+0xfa/0x3b0
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #1 (&mm->mmap_lock){++++}-{4:4}:
       lock_acquire+0x120/0x360
       __might_fault+0xcc/0x130
       _copy_to_user+0x2c/0xb0
       fiemap_fill_next_extent+0x1c0/0x390
       ocfs2_fiemap+0x888/0xc90
       do_vfs_ioctl+0x1173/0x1430
       __se_sys_ioctl+0x82/0x170
       do_syscall_64+0xfa/0x3b0
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (&ocfs2_file_ip_alloc_sem_key){++++}-{4:4}:
       validate_chain+0xb9b/0x2140
       __lock_acquire+0xab9/0xd20
       lock_acquire+0x120/0x360
       down_write+0x96/0x1f0
       ocfs2_page_mkwrite+0x2ff/0xc40
       do_page_mkwrite+0x14d/0x310
       __handle_mm_fault+0x1916/0x5440
       handle_mm_fault+0x40a/0x8e0
       do_user_addr_fault+0x764/0x1390
       exc_page_fault+0x76/0xf0
       asm_exc_page_fault+0x26/0x30
       rep_movs_alternative+0x54/0x90
       _copy_to_iter+0x24f/0x1790
       copy_page_to_iter+0x10c/0x1c0
       filemap_read+0x7c0/0x11a0
       ocfs2_file_read_iter+0x3fa/0xa80
       vfs_read+0x55a/0xa30
       ksys_read+0x145/0x250
       do_syscall_64+0xfa/0x3b0
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

Chain exists of:
  &ocfs2_file_ip_alloc_sem_key --> &mm->mmap_lock --> sb_pagefaults#4

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  rlock(sb_pagefaults#4);
                               lock(&mm->mmap_lock);
                               lock(sb_pagefaults#4);
  lock(&ocfs2_file_ip_alloc_sem_key);

 *** DEADLOCK ***

3 locks held by syz.6.436/9712:
 #0: ffff8881130af0f8 (&f->f_pos_lock){+.+.}-{4:4}, at: fdget_pos+0x247/0x320
 #1: ffff88802a08ed60 (&mm->mmap_lock){++++}-{4:4}, at: lock_mm_and_find_vma+0x32/0x300
 #2: ffff8881228b8520 (sb_pagefaults#4){.+.+}-{0:0}, at: do_page_mkwrite+0x14d/0x310

stack backtrace:
CPU: 0 UID: 0 PID: 9712 Comm: syz.6.436 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_write+0x96/0x1f0
 ocfs2_page_mkwrite+0x2ff/0xc40
 do_page_mkwrite+0x14d/0x310
 __handle_mm_fault+0x1916/0x5440
 handle_mm_fault+0x40a/0x8e0
 do_user_addr_fault+0x764/0x1390
 exc_page_fault+0x76/0xf0
 asm_exc_page_fault+0x26/0x30
RIP: 0010:rep_movs_alternative+0x54/0x90
Code: 00 00 00 0f 1f 00 48 8b 06 48 89 07 48 83 c6 08 48 83 c7 08 83 e9 08 74 db 83 f9 08 73 e8 eb c5 eb 05 c3 cc cc cc cc 48 8b 06 <48> 89 07 48 8d 47 08 48 83 e0 f8 48 29 f8 48 01 c7 48 01 c6 48 29
RSP: 0018:ffffc9000327f6d8 EFLAGS: 00010206
RAX: 0000000000000000 RBX: ffff8880361a2000 RCX: 0000000000001000
RDX: 0000000000000000 RSI: ffff8880361a2000 RDI: 0000200000004880
RBP: ffffc9000327f848 R08: ffff8880361a2fff R09: 1ffff11006c345ff
R10: dffffc0000000000 R11: ffffed1006c34600 R12: 1ffff9200064ffaf
R13: 0000200000004880 R14: ffffc9000327fd88 R15: 0000000000001000
 _copy_to_iter+0x24f/0x1790
 copy_page_to_iter+0x10c/0x1c0
 filemap_read+0x7c0/0x11a0
 ocfs2_file_read_iter+0x3fa/0xa80
 vfs_read+0x55a/0xa30
 ksys_read+0x145/0x250
 do_syscall_64+0xfa/0x3b0
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fec9a98ebe9
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:00007fec9b8a9038 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00007fec9abc5fa0 RCX: 00007fec9a98ebe9
RDX: 00000000ffffffbc RSI: 0000200000004880 RDI: 0000000000000005
RBP: 00007fec9aa11e19 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fec9abc6038 R14: 00007fec9abc5fa0 R15: 00007ffed7cfdcd8
 </TASK>
OCFS2: ERROR (device loop6): 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.6.436,9712,1):ocfs2_claim_suballoc_bits:2063 ERROR: status = -30
(syz.6.436,9712,1):__ocfs2_claim_clusters:2438 ERROR: status = -30
(syz.6.436,9712,1):__ocfs2_claim_clusters:2446 ERROR: status = -30
(syz.6.436,9712,1):ocfs2_local_alloc_new_window:1199 ERROR: status = -30
(syz.6.436,9712,0):ocfs2_local_alloc_new_window:1224 ERROR: status = -30
(syz.6.436,9712,0):ocfs2_local_alloc_slide_window:1298 ERROR: status = -30
(syz.6.436,9712,0):ocfs2_local_alloc_slide_window:1317 ERROR: status = -30
(syz.6.436,9712,0):ocfs2_reserve_local_alloc_bits:672 ERROR: status = -30
(syz.6.436,9712,0):ocfs2_reserve_local_alloc_bits:710 ERROR: status = -30
(syz.6.436,9712,0):ocfs2_reserve_clusters_with_limit:1172 ERROR: status = -30
(syz.6.436,9712,0):ocfs2_reserve_clusters_with_limit:1221 ERROR: status = -30
(syz.6.436,9712,0):ocfs2_lock_allocators:2775 ERROR: status = -30
(syz.6.436,9712,1):ocfs2_write_begin_nolock:1723 ERROR: status = -30
(syz.6.436,9712,1):__ocfs2_page_mkwrite:97 ERROR: status = -30
OCFS2: ERROR (device loop6): 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.6.436,9712,1):ocfs2_claim_suballoc_bits:2063 ERROR: status = -30
(syz.6.436,9712,1):__ocfs2_claim_clusters:2438 ERROR: status = -30
(syz.6.436,9712,1):__ocfs2_claim_clusters:2446 ERROR: status = -30
(syz.6.436,9712,1):ocfs2_local_alloc_new_window:1199 ERROR: status = -30
(syz.6.436,9712,0):ocfs2_local_alloc_new_window:1224 ERROR: status = -30
(syz.6.436,9712,0):ocfs2_local_alloc_slide_window:1298 ERROR: status = -30
(syz.6.436,9712,0):ocfs2_local_alloc_slide_window:1317 ERROR: status = -30
(syz.6.436,9712,0):ocfs2_reserve_local_alloc_bits:672 ERROR: status = -30
(syz.6.436,9712,0):ocfs2_reserve_local_alloc_bits:710 ERROR: status = -30
(syz.6.436,9712,0):ocfs2_reserve_clusters_with_limit:1172 ERROR: status = -30
(syz.6.436,9712,0):ocfs2_reserve_clusters_with_limit:1221 ERROR: status = -30
(syz.6.436,9712,0):ocfs2_lock_allocators:2775 ERROR: status = -30
(syz.6.436,9712,0):ocfs2_write_begin_nolock:1723 ERROR: status = -30
(syz.6.436,9712,0):__ocfs2_page_mkwrite:97 ERROR: status = -30
