======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.0.8545/25576 is trying to acquire lock:
ffffffff8ec848e0 (fs_reclaim){+.+.}-{0:0}, at: kmem_cache_alloc_lru_noprof+0x65/0x5f0

but task is already holding lock:
ffff88810b606180 (&root->kernfs_rwsem){++++}-{4:4}, at: kernfs_iop_lookup+0x5f/0x320

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #8 (&root->kernfs_rwsem){++++}-{4:4}:
       down_write+0x96/0x200
       kernfs_add_one+0x41/0x5e0
       kernfs_create_dir_ns+0x1a1/0x230
       internal_create_group+0x440/0x1180
       cpuhp_invoke_callback+0x434/0x810
       cpuhp_issue_call+0x3f0/0x750
       __cpuhp_setup_state_cpuslocked+0x3f4/0x6f0
       __cpuhp_setup_state+0x3f/0x60
       do_one_initcall+0x250/0x870
       do_initcall_level+0x10a/0x1a0
       do_initcalls+0x59/0xa0
       kernel_init_freeable+0x29d/0x3e0
       kernel_init+0x1d/0x1d0
       ret_from_fork+0x514/0xb70
       ret_from_fork_asm+0x1a/0x30

-> #7 (cpuhp_state_mutex){+.+.}-{4:4}:

-> #6 (cpu_hotplug_lock){++++}-{0:0}:
       cpus_read_lock+0x42/0x160
       static_key_slow_inc+0x12/0x30
       nbd_genl_reconfigure+0x1301/0x1e80
       genl_family_rcv_msg_doit+0x233/0x340
       genl_rcv_msg+0x614/0x7a0
       netlink_rcv_skb+0x226/0x4a0
       genl_rcv+0x28/0x40
       netlink_unicast+0x7bb/0x940
       netlink_sendmsg+0x813/0xb40
       sock_sendmsg_nosec+0x13a/0x180
       ____sys_sendmsg+0x54e/0x850
       ___sys_sendmsg+0x2a5/0x360
       __x64_sys_sendmsg+0x1b1/0x290
       do_syscall_64+0x174/0x580
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #5 (&nsock->tx_lock){+.+.}-{4:4}:
       __mutex_lock+0x19d/0x1550
       nbd_queue_rq+0x373/0x1150
       blk_mq_dispatch_rq_list+0x499/0x1990
       __blk_mq_sched_dispatch_requests+0xd36/0x1580
       blk_mq_sched_dispatch_requests+0xd7/0x190
       blk_mq_run_work_fn+0x16c/0x300
       process_scheduled_works+0xa8e/0x14e0
       worker_thread+0xa47/0xfb0
       kthread+0x388/0x470
       ret_from_fork+0x514/0xb70
       ret_from_fork_asm+0x1a/0x30

-> #4 (&cmd->lock){+.+.}-{4:4}:
       __mutex_lock+0x19d/0x1550
       nbd_queue_rq+0xc1/0x1150
       blk_mq_dispatch_rq_list+0x499/0x1990
       __blk_mq_sched_dispatch_requests+0xd36/0x1580
       blk_mq_sched_dispatch_requests+0xd7/0x190
       blk_mq_run_work_fn+0x16c/0x300
       process_scheduled_works+0xa8e/0x14e0
       worker_thread+0xa47/0xfb0
       kthread+0x388/0x470
       ret_from_fork+0x514/0xb70
       ret_from_fork_asm+0x1a/0x30

-> #3 (set->srcu){.+.+}-{0:0}:
       __synchronize_srcu+0xc9/0x2f0
       elevator_switch+0x1e8/0x7b0
       elevator_change+0x2fa/0x480
       elevator_set_default+0x375/0x440
       blk_register_queue+0x3f3/0x4e0
       __add_disk+0x6cb/0xe30
       add_disk_fwnode+0x100/0x3a0
       nbd_dev_add+0x733/0xb60
       nbd_init+0x15f/0x1e0
       do_one_initcall+0x250/0x870
       do_initcall_level+0x10a/0x1a0
       do_initcalls+0x59/0xa0
       kernel_init_freeable+0x29d/0x3e0
       kernel_init+0x1d/0x1d0
       ret_from_fork+0x514/0xb70
       ret_from_fork_asm+0x1a/0x30

-> #2 (&q->elevator_lock){+.+.}-{4:4}:
       __mutex_lock+0x19d/0x1550
       elevator_change+0x1af/0x480
       elevator_set_none+0xb5/0x140
       blk_mq_update_nr_hw_queues+0x5ef/0x19f0
       nbd_start_device+0x189/0xb30
       nbd_genl_connect+0x1597/0x1c10
       genl_family_rcv_msg_doit+0x233/0x340
       genl_rcv_msg+0x614/0x7a0
       netlink_rcv_skb+0x226/0x4a0
       genl_rcv+0x28/0x40
       netlink_unicast+0x7bb/0x940
       netlink_sendmsg+0x813/0xb40
       sock_sendmsg_nosec+0x13a/0x180
       ____sys_sendmsg+0x54e/0x850
       ___sys_sendmsg+0x2a5/0x360
       __x64_sys_sendmsg+0x1b1/0x290
       do_syscall_64+0x174/0x580
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #1 (&q->q_usage_counter(io)#49){++++}-{0:0}:
       blk_alloc_queue+0x544/0x690
       __blk_mq_alloc_disk+0x194/0x390
       nbd_dev_add+0x494/0xb60
       nbd_init+0x15f/0x1e0
       do_one_initcall+0x250/0x870
       do_initcall_level+0x10a/0x1a0
       do_initcalls+0x59/0xa0
       kernel_init_freeable+0x29d/0x3e0
       kernel_init+0x1d/0x1d0
       ret_from_fork+0x514/0xb70
       ret_from_fork_asm+0x1a/0x30

-> #0 (fs_reclaim){+.+.}-{0:0}:
       __lock_acquire+0x1520/0x2cf0
       lock_acquire+0x106/0x350
       fs_reclaim_acquire+0x71/0x100
       kmem_cache_alloc_lru_noprof+0x65/0x5f0
       alloc_inode+0xb8/0x1b0
       iget_locked+0x131/0x6a0
       kernfs_get_inode+0x4f/0x770
       kernfs_iop_lookup+0x1fe/0x320
       lookup_one_qstr_excl+0x12d/0x360
       filename_create+0x20e/0x370
       filename_mkdirat+0xd2/0x510
       __se_sys_mkdirat+0x35/0x150
       do_syscall_64+0x174/0x580
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

Chain exists of:
  fs_reclaim --> cpuhp_state_mutex --> &root->kernfs_rwsem

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  rlock(&root->kernfs_rwsem);
                               lock(cpuhp_state_mutex);
                               lock(&root->kernfs_rwsem);
  lock(fs_reclaim);

 *** DEADLOCK ***

3 locks held by syz.0.8545/25576:
 #0: ffff8881bedee450 (sb_writers#10){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90
 #1: ffff8881b844cf80 (&type->i_mutex_dir_key#7/1){+.+.}-{4:4}, at: filename_create+0x200/0x370
 #2: ffff88810b606180 (&root->kernfs_rwsem){++++}-{4:4}, at: kernfs_iop_lookup+0x5f/0x320

stack backtrace:
CPU: 0 UID: 0 PID: 25576 Comm: syz.0.8545 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+0x1520/0x2cf0
 lock_acquire+0x106/0x350
 fs_reclaim_acquire+0x71/0x100
 kmem_cache_alloc_lru_noprof+0x65/0x5f0
 alloc_inode+0xb8/0x1b0
 iget_locked+0x131/0x6a0
 kernfs_get_inode+0x4f/0x770
 kernfs_iop_lookup+0x1fe/0x320
 lookup_one_qstr_excl+0x12d/0x360
 filename_create+0x20e/0x370
 filename_mkdirat+0xd2/0x510
 __se_sys_mkdirat+0x35/0x150
 do_syscall_64+0x174/0x580
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f8ce219de99
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:00007f8ce2f90028 EFLAGS: 00000246 ORIG_RAX: 0000000000000102
RAX: ffffffffffffffda RBX: 00007f8ce2426090 RCX: 00007f8ce219de99
RDX: 00000000000001ff RSI: 0000200000000000 RDI: ffffffffffffff9c
RBP: 00007f8ce2233eaf R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f8ce2426128 R14: 00007f8ce2426090 R15: 00007ffda5c0fba8
 </TASK>
