====================================================== WARNING: possible circular locking dependency detected 6.17.0-rc1-syzkaller-00016-g8742b2d8935f #0 Not tainted ------------------------------------------------------ syz.4.1061/9222 is trying to acquire lock: ffff88801c6f5188 (&root->kernfs_rwsem){++++}-{4:4}, at: kernfs_remove fs/kernfs/dir.c:1549 [inline] ffff88801c6f5188 (&root->kernfs_rwsem){++++}-{4:4}, at: kernfs_remove+0x2f/0x50 fs/kernfs/dir.c:1540 but task is already holding lock: ffff888026623b88 (&q->q_usage_counter(io)#53){++++}-{0:0}, at: blk_mq_freeze_queue_nomemsave block/blk-mq.c:205 [inline] ffff888026623b88 (&q->q_usage_counter(io)#53){++++}-{0:0}, at: __blk_mq_update_nr_hw_queues+0x363/0x11a0 block/blk-mq.c:5060 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&q->q_usage_counter(io)#53){++++}-{0:0}: blk_alloc_queue+0x619/0x760 block/blk-core.c:461 blk_mq_alloc_queue+0x172/0x280 block/blk-mq.c:4400 __blk_mq_alloc_disk+0x29/0x120 block/blk-mq.c:4447 nbd_dev_add+0x492/0xbb0 drivers/block/nbd.c:1943 nbd_init+0x181/0x320 drivers/block/nbd.c:2680 do_one_initcall+0x120/0x6e0 init/main.c:1269 do_initcall_level init/main.c:1331 [inline] do_initcalls init/main.c:1347 [inline] do_basic_setup init/main.c:1366 [inline] kernel_init_freeable+0x5c2/0x910 init/main.c:1579 kernel_init+0x1c/0x2b0 init/main.c:1469 ret_from_fork+0x5d7/0x6f0 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #1 (fs_reclaim){+.+.}-{0:0}: __fs_reclaim_acquire mm/page_alloc.c:4234 [inline] fs_reclaim_acquire+0x102/0x150 mm/page_alloc.c:4248 might_alloc include/linux/sched/mm.h:318 [inline] slab_pre_alloc_hook mm/slub.c:4131 [inline] slab_alloc_node mm/slub.c:4209 [inline] kmem_cache_alloc_lru_noprof+0x58/0x3b0 mm/slub.c:4248 alloc_inode+0xc3/0x240 fs/inode.c:348 iget_locked+0x2e4/0x830 fs/inode.c:1438 kernfs_get_inode+0x48/0x460 fs/kernfs/inode.c:253 kernfs_fill_super fs/kernfs/mount.c:307 [inline] kernfs_get_tree+0x5fd/0xb00 fs/kernfs/mount.c:391 sysfs_get_tree+0x41/0x140 fs/sysfs/mount.c:31 vfs_get_tree+0x8b/0x340 fs/super.c:1815 do_new_mount fs/namespace.c:3805 [inline] path_mount+0x1482/0x1fd0 fs/namespace.c:4120 do_mount fs/namespace.c:4133 [inline] __do_sys_mount fs/namespace.c:4344 [inline] __se_sys_mount fs/namespace.c:4321 [inline] __x64_sys_mount+0x28d/0x310 fs/namespace.c:4321 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&root->kernfs_rwsem){++++}-{4:4}: check_prev_add kernel/locking/lockdep.c:3165 [inline] check_prevs_add kernel/locking/lockdep.c:3284 [inline] validate_chain kernel/locking/lockdep.c:3908 [inline] __lock_acquire+0x12a6/0x1ce0 kernel/locking/lockdep.c:5237 lock_acquire kernel/locking/lockdep.c:5868 [inline] lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5825 down_write+0x92/0x200 kernel/locking/rwsem.c:1590 kernfs_remove fs/kernfs/dir.c:1549 [inline] kernfs_remove+0x2f/0x50 fs/kernfs/dir.c:1540 sysfs_remove_dir+0xc8/0x100 fs/sysfs/dir.c:101 __kobject_del+0xe2/0x1f0 lib/kobject.c:604 kobject_del lib/kobject.c:627 [inline] kobject_del+0x3f/0x60 lib/kobject.c:619 elv_unregister_queue block/elevator.c:503 [inline] elevator_change_done+0x56b/0x6a0 block/elevator.c:646 elevator_change+0x30b/0x580 block/elevator.c:694 elevator_set_none+0xaa/0x120 block/elevator.c:781 blk_mq_elv_switch_none block/blk-mq.c:5023 [inline] __blk_mq_update_nr_hw_queues+0x531/0x11a0 block/blk-mq.c:5068 blk_mq_update_nr_hw_queues+0x3b/0x60 block/blk-mq.c:5119 nbd_start_device+0x1b0/0xd70 drivers/block/nbd.c:1478 nbd_start_device_ioctl drivers/block/nbd.c:1537 [inline] __nbd_ioctl drivers/block/nbd.c:1612 [inline] nbd_ioctl+0x219/0xda0 drivers/block/nbd.c:1652 blkdev_ioctl+0x277/0x6d0 block/ioctl.c:705 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:598 [inline] __se_sys_ioctl fs/ioctl.c:584 [inline] __x64_sys_ioctl+0x18b/0x210 fs/ioctl.c:584 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Chain exists of: &root->kernfs_rwsem --> fs_reclaim --> &q->q_usage_counter(io)#53 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&q->q_usage_counter(io)#53); lock(fs_reclaim); lock(&q->q_usage_counter(io)#53); lock(&root->kernfs_rwsem); *** DEADLOCK *** 4 locks held by syz.4.1061/9222: #0: ffff888026bcf988 (&set->update_nr_hwq_lock){++++}-{4:4}, at: blk_mq_update_nr_hw_queues+0x27/0x60 block/blk-mq.c:5117 #1: ffff888026bcf8d8 (&set->tag_list_lock){+.+.}-{4:4}, at: blk_mq_update_nr_hw_queues+0x31/0x60 block/blk-mq.c:5118 #2: ffff888026623b88 (&q->q_usage_counter(io)#53){++++}-{0:0}, at: blk_mq_freeze_queue_nomemsave block/blk-mq.c:205 [inline] #2: ffff888026623b88 (&q->q_usage_counter(io)#53){++++}-{0:0}, at: __blk_mq_update_nr_hw_queues+0x363/0x11a0 block/blk-mq.c:5060 #3: ffff888026623bc0 (&q->q_usage_counter(queue)#5){+.+.}-{0:0}, at: blk_mq_freeze_queue_nomemsave block/blk-mq.c:205 [inline] #3: ffff888026623bc0 (&q->q_usage_counter(queue)#5){+.+.}-{0:0}, at: __blk_mq_update_nr_hw_queues+0x363/0x11a0 block/blk-mq.c:5060 stack backtrace: CPU: 1 UID: 0 PID: 9222 Comm: syz.4.1061 Not tainted 6.17.0-rc1-syzkaller-00016-g8742b2d8935f #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_circular_bug+0x275/0x350 kernel/locking/lockdep.c:2043 check_noncircular+0x14c/0x170 kernel/locking/lockdep.c:2175 check_prev_add kernel/locking/lockdep.c:3165 [inline] check_prevs_add kernel/locking/lockdep.c:3284 [inline] validate_chain kernel/locking/lockdep.c:3908 [inline] __lock_acquire+0x12a6/0x1ce0 kernel/locking/lockdep.c:5237 lock_acquire kernel/locking/lockdep.c:5868 [inline] lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5825 down_write+0x92/0x200 kernel/locking/rwsem.c:1590 kernfs_remove fs/kernfs/dir.c:1549 [inline] kernfs_remove+0x2f/0x50 fs/kernfs/dir.c:1540 sysfs_remove_dir+0xc8/0x100 fs/sysfs/dir.c:101 __kobject_del+0xe2/0x1f0 lib/kobject.c:604 kobject_del lib/kobject.c:627 [inline] kobject_del+0x3f/0x60 lib/kobject.c:619 elv_unregister_queue block/elevator.c:503 [inline] elevator_change_done+0x56b/0x6a0 block/elevator.c:646 elevator_change+0x30b/0x580 block/elevator.c:694 elevator_set_none+0xaa/0x120 block/elevator.c:781 blk_mq_elv_switch_none block/blk-mq.c:5023 [inline] __blk_mq_update_nr_hw_queues+0x531/0x11a0 block/blk-mq.c:5068 blk_mq_update_nr_hw_queues+0x3b/0x60 block/blk-mq.c:5119 nbd_start_device+0x1b0/0xd70 drivers/block/nbd.c:1478 nbd_start_device_ioctl drivers/block/nbd.c:1537 [inline] __nbd_ioctl drivers/block/nbd.c:1612 [inline] nbd_ioctl+0x219/0xda0 drivers/block/nbd.c:1652 blkdev_ioctl+0x277/0x6d0 block/ioctl.c:705 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:598 [inline] __se_sys_ioctl fs/ioctl.c:584 [inline] __x64_sys_ioctl+0x18b/0x210 fs/ioctl.c:584 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fadf8d8ebe9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fadf9c04038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007fadf8fb6090 RCX: 00007fadf8d8ebe9 RDX: 0000000000000000 RSI: 000000000000ab03 RDI: 0000000000000003 RBP: 00007fadf8e11e19 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fadf8fb6128 R14: 00007fadf8fb6090 R15: 00007ffc1c7d49d8