Re: [PATCH] ublk: fix AB-BA lockdep warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On May 17, 2023 / 21:34, Ming Lei wrote:
> When handling UBLK_IO_FETCH_REQ, ctx->uring_lock is grabbed first, then
> ub->mutex is acquired.
> 
> When handling UBLK_CMD_STOP_DEV or UBLK_CMD_DEL_DEV, ub->mutex is
> grabbed first, then calling io_uring_cmd_done() for canceling uring
> command, in which ctx->uring_lock may be required.
> 
> Real deadlock only happens when all the above commands are issued from
> same uring context, and in reality different uring contexts are often used
> for handing control command and IO command.
> 
> Fix the issue by using io_uring_cmd_complete_in_task() to cancel command
> in ublk_cancel_dev(ublk_cancel_queue).
> 
> Reported-by: Shinichiro Kawasaki <shinichiro.kawasaki@xxxxxxx>
> Closes: https://lore.kernel.org/linux-block/becol2g7sawl4rsjq2dztsbc7mqypfqko6wzsyoyazqydoasml@rcxarzwidrhk
> Cc: Ziyang Zhang <ZiyangZhang@xxxxxxxxxxxxxxxxx>
> Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx>

Using Ziyang's new blktests test cases, I confirmed this patch avoids the
failure I reported. Thanks.

Tested-by: Shinichiro Kawasaki <shinichiro.kawasaki@xxxxxxx>



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux