======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.1.7/5712 is trying to acquire lock:
ffffffff8f29aca0 (fs_reclaim){+.+.}-{0:0}, at: kmem_cache_alloc_noprof+0x64/0x610

but task is already holding lock:
ffff88816ca13bc0 (&q->blkcg_mutex){+.+.}-{4:4}, at: blkg_conf_prep+0xa3/0xd80

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&q->blkcg_mutex){+.+.}-{4:4}:
       __mutex_lock+0x19d/0x1550
       blkcg_activate_policy+0x1cb/0x8e0
       blk_throtl_init+0x34a/0x530
       tg_set_conf+0x1db/0x4e0
       cgroup_file_write+0x331/0x8f0
       kernfs_fop_write_iter+0x44d/0x670
       vfs_write+0x612/0xba0
       ksys_write+0x150/0x270
       do_syscall_64+0x166/0x520
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #1 (&q->q_usage_counter(io)#17){++++}-{0:0}:
       blk_alloc_queue+0x5a8/0x780
       __blk_mq_alloc_disk+0x194/0x390
       loop_add+0x4de/0xc20
       loop_init+0xd7/0x160
       do_one_initcall+0x250/0x870
       do_initcall_level+0x10a/0x1a0
       do_initcalls+0xaf/0x140
       kernel_init_freeable+0x29d/0x3e0
       kernel_init+0x22/0x1d0
       ret_from_fork+0x514/0xb70
       ret_from_fork_asm+0x1a/0x30

-> #0 (fs_reclaim){+.+.}-{0:0}:
       __lock_acquire+0x164c/0x2de0
       lock_acquire+0x115/0x350
       fs_reclaim_acquire+0x71/0x100
       kmem_cache_alloc_noprof+0x64/0x610
       __radix_tree_preload+0x324/0x940
       blkg_conf_prep+0x621/0xd80
       tg_set_conf+0x20b/0x4e0
       cgroup_file_write+0x331/0x8f0
       kernfs_fop_write_iter+0x44d/0x670
       vfs_write+0x612/0xba0
       ksys_write+0x150/0x270
       do_syscall_64+0x166/0x520
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

Chain exists of:
  fs_reclaim --> &q->q_usage_counter(io)#17 --> &q->blkcg_mutex

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&q->blkcg_mutex);
                               lock(&q->q_usage_counter(io)#17);
                               lock(&q->blkcg_mutex);
  lock(fs_reclaim);

 *** DEADLOCK ***

locks held by syz.1.7/5712: 6, last CPU#0:
 #0: ffff88810fc306f0 (&f->f_pos_lock){+.+.}-{4:4}, at: fdget_pos+0x246/0x320
 #1: ffff888101ffa460 (sb_writers#10){.+.+}-{0:0}, at: vfs_write+0x22b/0xba0
 #2: ffff8880134b4080 (&of->mutex){+.+.}-{4:4}, at: kernfs_fop_write_iter+0x25e/0x670
 #3: ffff8880135ae4b8 (kn->active#55){.+.+}-{0:0}, at: kernfs_fop_write_iter+0x2b9/0x670
 #4: ffff88816ca13a40 (&q->rq_qos_mutex){+.+.}-{4:4}, at: blkg_conf_open_bdev+0x2a8/0x3c0
 #5: ffff88816ca13bc0 (&q->blkcg_mutex){+.+.}-{4:4}, at: blkg_conf_prep+0xa3/0xd80

stack backtrace:
CPU: 0 UID: 0 PID: 5712 Comm: syz.1.7 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+0x2e2/0x300
 check_noncircular+0x12f/0x150
 __lock_acquire+0x164c/0x2de0
 lock_acquire+0x115/0x350
 fs_reclaim_acquire+0x71/0x100
 kmem_cache_alloc_noprof+0x64/0x610
 __radix_tree_preload+0x324/0x940
 blkg_conf_prep+0x621/0xd80
 tg_set_conf+0x20b/0x4e0
 cgroup_file_write+0x331/0x8f0
 kernfs_fop_write_iter+0x44d/0x670
 vfs_write+0x612/0xba0
 ksys_write+0x150/0x270
 do_syscall_64+0x166/0x520
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f3be0b9e199
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:00007f3be1a2e028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f3be0e25fa0 RCX: 00007f3be0b9e199
RDX: 000000000000006a RSI: 00002000000000c0 RDI: 0000000000000005
RBP: 00007f3be0c350b8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f3be0e26038 R14: 00007f3be0e25fa0 R15: 00007fff3aa9de58
 </TASK>
