============================================
WARNING: possible recursive locking detected
5.17.0-rc5-next-20220222-syzkaller #0 Not tainted
--------------------------------------------
syz-executor.5/3621 is trying to acquire lock:
ffff888046930390 (&sem->internal_rwsem#2){++++}-{3:3}, at: f2fs_down_write fs/f2fs/f2fs.h:2160 [inline]
ffff888046930390 (&sem->internal_rwsem#2){++++}-{3:3}, at: f2fs_write_checkpoint+0x535/0x5ea0 fs/f2fs/checkpoint.c:1620

but task is already holding lock:
ffff888046931398 (&sem->internal_rwsem#2){++++}-{3:3}, at: f2fs_down_write fs/f2fs/f2fs.h:2160 [inline]
ffff888046931398 (&sem->internal_rwsem#2){++++}-{3:3}, at: f2fs_issue_checkpoint+0x149/0x480 fs/f2fs/checkpoint.c:1839

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&sem->internal_rwsem#2);
  lock(&sem->internal_rwsem#2);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

2 locks held by syz-executor.5/3621:
 #0: ffff88804521c0e0 (&type->s_umount_key#51){+.+.}-{3:3}, at: deactivate_super+0xa5/0xd0 fs/super.c:362
 #1: ffff888046931398 (&sem->internal_rwsem#2){++++}-{3:3}, at: f2fs_down_write fs/f2fs/f2fs.h:2160 [inline]
 #1: ffff888046931398 (&sem->internal_rwsem#2){++++}-{3:3}, at: f2fs_issue_checkpoint+0x149/0x480 fs/f2fs/checkpoint.c:1839

stack backtrace:
CPU: 1 PID: 3621 Comm: syz-executor.5 Not tainted 5.17.0-rc5-next-20220222-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 print_deadlock_bug kernel/locking/lockdep.c:2989 [inline]
 check_deadlock kernel/locking/lockdep.c:3032 [inline]
 validate_chain kernel/locking/lockdep.c:3821 [inline]
 __lock_acquire.cold+0x12c/0x3a7 kernel/locking/lockdep.c:5060
 lock_acquire kernel/locking/lockdep.c:5672 [inline]
 lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5637
 down_write+0x90/0x150 kernel/locking/rwsem.c:1514
 f2fs_down_write fs/f2fs/f2fs.h:2160 [inline]
 f2fs_write_checkpoint+0x535/0x5ea0 fs/f2fs/checkpoint.c:1620
 __write_checkpoint_sync fs/f2fs/checkpoint.c:1750 [inline]
 f2fs_issue_checkpoint+0x156/0x480 fs/f2fs/checkpoint.c:1847
 f2fs_sync_fs+0x20f/0x420 fs/f2fs/super.c:1645
 sync_filesystem.part.0+0x13c/0x1d0 fs/sync.c:66
 sync_filesystem+0x8b/0xc0 fs/sync.c:43
 generic_shutdown_super+0x70/0x400 fs/super.c:445
 kill_block_super+0x97/0xf0 fs/super.c:1394
 kill_f2fs_super+0x2b3/0x3c0 fs/f2fs/super.c:4534
 deactivate_locked_super+0x94/0x160 fs/super.c:332
 deactivate_super+0xad/0xd0 fs/super.c:363
 cleanup_mnt+0x3a2/0x540 fs/namespace.c:1171
 task_work_run+0xdd/0x1a0 kernel/task_work.c:164
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:176 [inline]
 exit_to_user_mode_prepare+0x27e/0x290 kernel/entry/common.c:208
 __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline]
 syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:301
 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7fad48c8a4b7
Code: ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd7e37a158 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007fad48c8a4b7
RDX: 00007ffd7e37a22a RSI: 000000000000000a RDI: 00007ffd7e37a220
RBP: 00007ffd7e37a220 R08: 00000000ffffffff R09: 00007ffd7e379ff0
R10: 00005555558ef8b3 R11: 0000000000000246 R12: 00007fad48ce21ea
R13: 00007ffd7e37b2e0 R14: 00005555558ef810 R15: 00007ffd7e37b320
 </TASK>