====================================================== WARNING: possible circular locking dependency detected 6.16.0-syzkaller #0 Not tainted ------------------------------------------------------ kworker/u8:8/4594 is trying to acquire lock: ffff88807caf5358 (&disk->open_mutex){+.+.}-{4:4}, at: __del_gendisk+0xf5/0xbd0 block/genhd.c:710 but task is already holding lock: ffff88807a3cf988 (&set->update_nr_hwq_lock){++++}-{4:4}, at: del_gendisk+0x136/0x1e0 block/genhd.c:822 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&set->update_nr_hwq_lock){++++}-{4:4}: down_write+0x92/0x200 kernel/locking/rwsem.c:1577 blk_mq_update_nr_hw_queues+0x32/0xcb0 block/blk-mq.c:5041 nbd_start_device+0x172/0xcd0 drivers/block/nbd.c:1476 nbd_start_device_ioctl drivers/block/nbd.c:1527 [inline] __nbd_ioctl drivers/block/nbd.c:1602 [inline] nbd_ioctl+0x219/0xda0 drivers/block/nbd.c:1642 blkdev_ioctl+0x274/0x6d0 block/ioctl.c:704 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:907 [inline] __se_sys_ioctl fs/ioctl.c:893 [inline] __x64_sys_ioctl+0x18e/0x210 fs/ioctl.c:893 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 -> #1 (&nbd->config_lock){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:602 [inline] __mutex_lock+0x199/0xb90 kernel/locking/mutex.c:747 refcount_dec_and_mutex_lock+0x51/0xc0 lib/refcount.c:118 nbd_config_put+0x31/0x750 drivers/block/nbd.c:1423 nbd_release+0xb7/0x190 drivers/block/nbd.c:1735 blkdev_put_whole+0xb0/0xf0 block/bdev.c:721 bdev_release+0x47e/0x6d0 block/bdev.c:1144 blkdev_release+0x15/0x20 block/fops.c:684 __fput+0x3ff/0xb70 fs/file_table.c:465 fput_close_sync+0x118/0x260 fs/file_table.c:570 __do_sys_close fs/open.c:1589 [inline] __se_sys_close fs/open.c:1574 [inline] __x64_sys_close+0x8b/0x120 fs/open.c:1574 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 (&disk->open_mutex){+.+.}-{4:4}: check_prev_add kernel/locking/lockdep.c:3168 [inline] check_prevs_add kernel/locking/lockdep.c:3287 [inline] validate_chain kernel/locking/lockdep.c:3911 [inline] __lock_acquire+0x126f/0x1c90 kernel/locking/lockdep.c:5240 lock_acquire kernel/locking/lockdep.c:5871 [inline] lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5828 __mutex_lock_common kernel/locking/mutex.c:602 [inline] __mutex_lock+0x199/0xb90 kernel/locking/mutex.c:747 __del_gendisk+0xf5/0xbd0 block/genhd.c:710 del_gendisk+0x13e/0x1e0 block/genhd.c:823 nbd_dev_remove+0x3b/0xe0 drivers/block/nbd.c:268 process_one_work+0x9cc/0x1b70 kernel/workqueue.c:3238 process_scheduled_works kernel/workqueue.c:3321 [inline] worker_thread+0x6c8/0xf10 kernel/workqueue.c:3402 kthread+0x3c2/0x780 kernel/kthread.c:464 ret_from_fork+0x5d4/0x6f0 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 other info that might help us debug this: Chain exists of: &disk->open_mutex --> &nbd->config_lock --> &set->update_nr_hwq_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- rlock(&set->update_nr_hwq_lock); lock(&nbd->config_lock); lock(&set->update_nr_hwq_lock); lock(&disk->open_mutex); *** DEADLOCK *** 3 locks held by kworker/u8:8/4594: #0: ffff888026956948 ((wq_completion)nbd-del){+.+.}-{0:0}, at: process_one_work+0x12a2/0x1b70 kernel/workqueue.c:3213 #1: ffffc9000e767d10 ((work_completion)(&nbd->remove_work)){+.+.}-{0:0}, at: process_one_work+0x929/0x1b70 kernel/workqueue.c:3214 #2: ffff88807a3cf988 (&set->update_nr_hwq_lock){++++}-{4:4}, at: del_gendisk+0x136/0x1e0 block/genhd.c:822 stack backtrace: CPU: 0 UID: 0 PID: 4594 Comm: kworker/u8:8 Not tainted 6.16.0-syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025 Workqueue: nbd-del nbd_dev_remove_work 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:2046 check_noncircular+0x14c/0x170 kernel/locking/lockdep.c:2178 check_prev_add kernel/locking/lockdep.c:3168 [inline] check_prevs_add kernel/locking/lockdep.c:3287 [inline] validate_chain kernel/locking/lockdep.c:3911 [inline] __lock_acquire+0x126f/0x1c90 kernel/locking/lockdep.c:5240 lock_acquire kernel/locking/lockdep.c:5871 [inline] lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5828 __mutex_lock_common kernel/locking/mutex.c:602 [inline] __mutex_lock+0x199/0xb90 kernel/locking/mutex.c:747 __del_gendisk+0xf5/0xbd0 block/genhd.c:710 del_gendisk+0x13e/0x1e0 block/genhd.c:823 nbd_dev_remove+0x3b/0xe0 drivers/block/nbd.c:268 process_one_work+0x9cc/0x1b70 kernel/workqueue.c:3238 process_scheduled_works kernel/workqueue.c:3321 [inline] worker_thread+0x6c8/0xf10 kernel/workqueue.c:3402 kthread+0x3c2/0x780 kernel/kthread.c:464 ret_from_fork+0x5d4/0x6f0 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245