linux-stable/drivers/block
Ming Lei ac5902f84b ublk: fix AB-BA lockdep warning
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@wdc.com>
Closes: https://lore.kernel.org/linux-block/becol2g7sawl4rsjq2dztsbc7mqypfqko6wzsyoyazqydoasml@rcxarzwidrhk
Cc: Ziyang Zhang <ZiyangZhang@linux.alibaba.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Tested-by: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20230517133408.210944-1-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2023-05-18 07:59:08 -06:00
..
aoe driver core: class: remove module * from class_create() 2023-03-17 15:16:33 +01:00
drbd for-6.4/block-2023-05-06 2023-05-06 08:28:58 -07:00
mtip32xx block: move from strlcpy with unused retval to strscpy 2022-09-21 19:45:04 -06:00
null_blk for-6.4/block-2023-05-06 2023-05-06 08:28:58 -07:00
rnbd block/rnbd: replace REQ_OP_FLUSH with REQ_OP_WRITE 2023-05-12 08:56:42 -06:00
xen-blkback xen/blkback: move blkif_get_x86_*_req() into blkback.c 2023-04-25 11:09:30 +02:00
zram for-6.4/block-2023-05-06 2023-05-06 08:28:58 -07:00
Kconfig block: ublk: switch to ioctl command encoding 2023-04-18 20:13:30 -06:00
Makefile Revert "pktcdvd: remove driver." 2023-01-04 14:44:13 -07:00
amiflop.c block: remove blk_cleanup_disk 2022-06-28 06:33:15 -06:00
ataflop.c block: remove blk_cleanup_disk 2022-06-28 06:33:15 -06:00
brd.c block/drivers: remove dead clear of random flag 2023-04-25 08:02:11 -06:00
floppy.c mm, treewide: redefine MAX_ORDER sanely 2023-04-05 19:42:46 -07:00
loop.c loop: LOOP_CONFIGURE: send uevents for partitions 2023-03-27 13:27:06 -06:00
n64cart.c block: remove blk_cleanup_disk 2022-06-28 06:33:15 -06:00
nbd.c nbd: Fix debugfs_create_dir error checking 2023-05-12 08:56:33 -06:00
pktcdvd.c Driver core changes for 6.4-rc1 2023-04-27 11:53:57 -07:00
ps3disk.c block: remove blk_cleanup_disk 2022-06-28 06:33:15 -06:00
ps3vram.c ps3vram: remove bio splitting 2023-01-29 15:18:35 -07:00
rbd.c driver core: bus: mark the struct bus_type for sysfs callbacks as constant 2023-03-23 13:20:40 +01:00
rbd_types.h
sunvdc.c block: sunvdc: add check for mdesc_grab() returning NULL 2023-03-15 08:48:58 -06:00
swim.c block: remove blk_cleanup_disk 2022-06-28 06:33:15 -06:00
swim3.c block: remove blk_cleanup_disk 2022-06-28 06:33:15 -06:00
swim_asm.S
ublk_drv.c ublk: fix AB-BA lockdep warning 2023-05-18 07:59:08 -06:00
virtio_blk.c virtio-blk: fix ZBD probe in kernels without ZBD support 2023-04-04 11:01:57 -04:00
xen-blkfront.c xen: branch for v6.2-rc4 2023-01-12 17:02:20 -06:00
z2ram.c block: remove blk_cleanup_disk 2022-06-28 06:33:15 -06:00