[axboe:block-7.2 42/44] drivers/block/ublk_drv.c:4433:3-9: preceding lock on line 4431

kernel test robot <[email protected]> Fri, 24 Jul 2026 00:55:32 +0800
Newsgroups dev.linux.lists.oe-kbuild
Message-ID <[email protected]>
BCC: [email protected]
CC: [email protected]
TO: Ming Lei <[email protected]>
CC: Jens Axboe <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux.git block-7.2
head:   432a9b2780c0a01caf547bd1fc2fcf28aeb8d173
commit: 432a9b2780c0a01caf547bd1fc2fcf28aeb8d173 [42/44] ublk: wait on ublk_dev_ready() instead of ub->completion
:::::: branch date: 4 days ago
:::::: commit date: 4 days ago
config: openrisc-randconfig-r053-20260723 (https://download.01.org/0day-ci/archive/20260724/[email protected]/config)
compiler: or1k-linux-gcc (GCC) 16.1.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Reported-by: Julia Lawall <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

cocci warnings: (new ones prefixed by >>)
>> drivers/block/ublk_drv.c:4433:3-9: preceding lock on line 4431

vim +4433 drivers/block/ublk_drv.c

47bdf1d29caec72 Seamus Connor 2026-01-14  4417  
432a9b2780c0a01 Ming Lei      2026-07-19  4418  /*
432a9b2780c0a01 Ming Lei      2026-07-19  4419   * Wait until all queues have fetched their I/O commands, and return with
432a9b2780c0a01 Ming Lei      2026-07-19  4420   * ub->mutex held and readiness guaranteed: then every queue's ->canceling
432a9b2780c0a01 Ming Lei      2026-07-19  4421   * is cleared. Ready may regress between wakeup and mutex_lock() (F_BATCH
432a9b2780c0a01 Ming Lei      2026-07-19  4422   * UNPREP, daemon death), so re-check it under the mutex and wait again.
432a9b2780c0a01 Ming Lei      2026-07-19  4423   */
432a9b2780c0a01 Ming Lei      2026-07-19  4424  static int ublk_wait_dev_ready_and_lock(struct ublk_device *ub)
432a9b2780c0a01 Ming Lei      2026-07-19  4425  {
432a9b2780c0a01 Ming Lei      2026-07-19  4426  	while (true) {
432a9b2780c0a01 Ming Lei      2026-07-19  4427  		if (wait_var_event_interruptible(&ub->nr_queue_ready,
432a9b2780c0a01 Ming Lei      2026-07-19  4428  						 ublk_dev_ready(ub)))
432a9b2780c0a01 Ming Lei      2026-07-19  4429  			return -EINTR;
432a9b2780c0a01 Ming Lei      2026-07-19  4430  
432a9b2780c0a01 Ming Lei      2026-07-19 @4431  		mutex_lock(&ub->mutex);
432a9b2780c0a01 Ming Lei      2026-07-19  4432  		if (ublk_dev_ready(ub))
432a9b2780c0a01 Ming Lei      2026-07-19 @4433  			return 0;
432a9b2780c0a01 Ming Lei      2026-07-19  4434  		mutex_unlock(&ub->mutex);
432a9b2780c0a01 Ming Lei      2026-07-19  4435  	}
432a9b2780c0a01 Ming Lei      2026-07-19  4436  }
432a9b2780c0a01 Ming Lei      2026-07-19  4437  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki