======================================================
WARNING: possible circular locking dependency detected
6.4.0-rc1-syzkaller-00011-g99a670b2069c #0 Not tainted
------------------------------------------------------
syz-executor.1/13281 is trying to acquire lock:
ff6000001298a0e0 (&type->s_umount_key#31){++++}-{3:3}, at: __do_sys_quotactl_fd fs/quota/quota.c:999 [inline]
ff6000001298a0e0 (&type->s_umount_key#31){++++}-{3:3}, at: sys_quotactl_fd+0x282/0x360 fs/quota/quota.c:972

but task is already holding lock:
ff6000001298a460 (sb_writers#4){.+.+}-{0:0}, at: __sb_start_write include/linux/fs.h:1494 [inline]
ff6000001298a460 (sb_writers#4){.+.+}-{0:0}, at: sb_start_write include/linux/fs.h:1569 [inline]
ff6000001298a460 (sb_writers#4){.+.+}-{0:0}, at: mnt_want_write+0x2c/0x78 fs/namespace.c:394

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (sb_writers#4){.+.+}-{0:0}:
       lock_acquire kernel/locking/lockdep.c:5691 [inline]
       lock_acquire+0x276/0x588 kernel/locking/lockdep.c:5656
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write include/linux/fs.h:1494 [inline]
       sb_start_write include/linux/fs.h:1569 [inline]
       write_mmp_block+0xc8/0x80c fs/ext4/mmp.c:50
       ext4_multi_mount_protect+0x3e8/0x75c fs/ext4/mmp.c:347
       __ext4_remount fs/ext4/super.c:6578 [inline]
       ext4_reconfigure+0x15e6/0x168a fs/ext4/super.c:6677
       reconfigure_super+0x1c8/0x492 fs/super.c:956
       vfs_fsconfig_locked fs/fsopen.c:254 [inline]
       __do_sys_fsconfig fs/fsopen.c:439 [inline]
       sys_fsconfig+0x87e/0x93a fs/fsopen.c:314
       syscall_handler+0xfa/0x148 arch/riscv/include/asm/syscall.h:90
       do_trap_ecall_u+0xea/0xec arch/riscv/kernel/traps.c:279
       ret_from_exception+0x0/0x64 arch/riscv/kernel/entry.S:102

-> #0 (&type->s_umount_key#31){++++}-{3:3}:
       check_noncircular+0x1da/0x1fa kernel/locking/lockdep.c:2188
       check_prev_add kernel/locking/lockdep.c:3108 [inline]
       check_prevs_add kernel/locking/lockdep.c:3227 [inline]
       validate_chain kernel/locking/lockdep.c:3842 [inline]
       __lock_acquire+0x19aa/0x34a2 kernel/locking/lockdep.c:5074
       lock_acquire kernel/locking/lockdep.c:5691 [inline]
       lock_acquire+0x276/0x588 kernel/locking/lockdep.c:5656
       down_read+0x3c/0x54 kernel/locking/rwsem.c:1520
       __do_sys_quotactl_fd fs/quota/quota.c:999 [inline]
       sys_quotactl_fd+0x282/0x360 fs/quota/quota.c:972
       syscall_handler+0xfa/0x148 arch/riscv/include/asm/syscall.h:90
       do_trap_ecall_u+0xea/0xec arch/riscv/kernel/traps.c:279
       ret_from_exception+0x0/0x64 arch/riscv/kernel/entry.S:102

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  rlock(sb_writers#4);
                               lock(&type->s_umount_key#31);
                               lock(sb_writers#4);
  rlock(&type->s_umount_key#31);

 *** DEADLOCK ***

1 lock held by syz-executor.1/13281:
 #0: ff6000001298a460 (sb_writers#4){.+.+}-{0:0}, at: __sb_start_write include/linux/fs.h:1494 [inline]
 #0: ff6000001298a460 (sb_writers#4){.+.+}-{0:0}, at: sb_start_write include/linux/fs.h:1569 [inline]
 #0: ff6000001298a460 (sb_writers#4){.+.+}-{0:0}, at: mnt_want_write+0x2c/0x78 fs/namespace.c:394

stack backtrace:
CPU: 1 PID: 13281 Comm: syz-executor.1 Not tainted 6.4.0-rc1-syzkaller-00011-g99a670b2069c #0
Hardware name: riscv-virtio,qemu (DT)
Call Trace:
[<ffffffff8000aa96>] dump_backtrace+0x2e/0x3c arch/riscv/kernel/stacktrace.c:121
[<ffffffff834dd8b4>] show_stack+0x34/0x40 arch/riscv/kernel/stacktrace.c:127
[<ffffffff8351d78e>] __dump_stack lib/dump_stack.c:88 [inline]
[<ffffffff8351d78e>] dump_stack_lvl+0xe0/0x14c lib/dump_stack.c:106
[<ffffffff8351d816>] dump_stack+0x1c/0x24 lib/dump_stack.c:113
[<ffffffff80131e8c>] print_circular_bug+0x3ae/0x47c kernel/locking/lockdep.c:2066
[<ffffffff80132134>] check_noncircular+0x1da/0x1fa kernel/locking/lockdep.c:2188
[<ffffffff80136356>] check_prev_add kernel/locking/lockdep.c:3108 [inline]
[<ffffffff80136356>] check_prevs_add kernel/locking/lockdep.c:3227 [inline]
[<ffffffff80136356>] validate_chain kernel/locking/lockdep.c:3842 [inline]
[<ffffffff80136356>] __lock_acquire+0x19aa/0x34a2 kernel/locking/lockdep.c:5074
[<ffffffff80138fee>] lock_acquire kernel/locking/lockdep.c:5691 [inline]
[<ffffffff80138fee>] lock_acquire+0x276/0x588 kernel/locking/lockdep.c:5656
[<ffffffff8352c5f0>] down_read+0x3c/0x54 kernel/locking/rwsem.c:1520
[<ffffffff806dffac>] __do_sys_quotactl_fd fs/quota/quota.c:999 [inline]
[<ffffffff806dffac>] sys_quotactl_fd+0x282/0x360 fs/quota/quota.c:972
[<ffffffff80009b3c>] syscall_handler+0xfa/0x148 arch/riscv/include/asm/syscall.h:90
[<ffffffff8351e9c2>] do_trap_ecall_u+0xea/0xec arch/riscv/kernel/traps.c:279
[<ffffffff8000621c>] ret_from_exception+0x0/0x64 arch/riscv/kernel/entry.S:102