loop0: detected capacity change from 0 to 4096
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.0.228/7693 is trying to acquire lock:
ffff8881205233f8 (&ni->ni_lock#2/5){+.+.}-{4:4}, at: ntfs_fallocate+0x7ed/0x1130

but task is already holding lock:
ffff888120523830 (mapping.invalidate_lock#4){++++}-{4:4}, at: ntfs_fallocate+0x3bd/0x1130

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (mapping.invalidate_lock#4){++++}-{4:4}:
       down_read+0x47/0x2e0
       filemap_fault+0x666/0x12e0
       __do_fault+0x138/0x390
       do_pte_missing+0x2206/0x3310
       handle_mm_fault+0x1b8c/0x32a0
       do_user_addr_fault+0xa73/0x1360
       exc_page_fault+0x6a/0xc0
       asm_exc_page_fault+0x26/0x30

-> #2 (vm_lock){++++}-{0:0}:
       __vma_enter_locked+0x243/0x710
       __vma_start_write+0x23/0x140
       mprotect_fixup+0x5e1/0xa50
       setup_arg_pages+0x565/0xae0
       load_elf_binary+0xc5e/0x2980
       bprm_execve+0x93d/0x1410
       kernel_execve+0x8ef/0x9e0
       try_to_run_init_process+0x13/0x60
       kernel_init+0xad/0x1d0
       ret_from_fork+0x51b/0xa40
       ret_from_fork_asm+0x1a/0x30

-> #1 (&mm->mmap_lock){++++}-{4:4}:
       __might_fault+0xcb/0x130
       _copy_to_user+0x2c/0xb0
       fiemap_fill_next_extent+0x1dd/0x3c0
       ni_fiemap+0x3c2/0xca0
       ntfs_fiemap+0x11d/0x1a0
       do_vfs_ioctl+0x125a/0x1530
       __se_sys_ioctl+0x82/0x170
       do_syscall_64+0xe2/0xf80
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (&ni->ni_lock#2/5){+.+.}-{4:4}:
       __lock_acquire+0x15a5/0x2cf0
       lock_acquire+0x106/0x330
       __mutex_lock+0x19f/0x1340
       ntfs_fallocate+0x7ed/0x1130
       vfs_fallocate+0x669/0x7e0
       __x64_sys_fallocate+0xc0/0x110
       do_syscall_64+0xe2/0xf80
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

Chain exists of:
  &ni->ni_lock#2/5 --> vm_lock --> mapping.invalidate_lock#4

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(mapping.invalidate_lock#4);
                               lock(vm_lock);
                               lock(mapping.invalidate_lock#4);
  lock(&ni->ni_lock#2/5);

 *** DEADLOCK ***

3 locks held by syz.0.228/7693:
 #0: ffff8881ac158420 (sb_writers#14){.+.+}-{0:0}, at: vfs_fallocate+0x5f0/0x7e0
 #1: ffff888120523690 (&sb->s_type->i_mutex_key#26){+.+.}-{4:4}, at: ntfs_fallocate+0x2ee/0x1130
 #2: ffff888120523830 (mapping.invalidate_lock#4){++++}-{4:4}, at: ntfs_fallocate+0x3bd/0x1130

stack backtrace:
CPU: 0 UID: 0 PID: 7693 Comm: syz.0.228 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+0xe8/0x150
 print_circular_bug+0x2e1/0x300
 check_noncircular+0x12e/0x150
 __lock_acquire+0x15a5/0x2cf0
 lock_acquire+0x106/0x330
 __mutex_lock+0x19f/0x1340
 ntfs_fallocate+0x7ed/0x1130
 vfs_fallocate+0x669/0x7e0
 __x64_sys_fallocate+0xc0/0x110
 do_syscall_64+0xe2/0xf80
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f0ad259acb9
Code: ff c3 66 2e 0f 1f 84 00 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
RSP: 002b:00007f0ad34e3028 EFLAGS: 00000246 ORIG_RAX: 000000000000011d
RAX: ffffffffffffffda RBX: 00007f0ad2805fa0 RCX: 00007f0ad259acb9
RDX: 0000000000004000 RSI: 0000000000000008 RDI: 0000000000000004
RBP: 00007f0ad2608bf7 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000004000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f0ad2806038 R14: 00007f0ad2805fa0 R15: 00007ffd68ae5758
 </TASK>
