block: ublk_drv: mark device as LIVE before adding disk
authorMing Lei <ming.lei@redhat.com>
Sat, 18 Mar 2023 14:12:31 +0000 (22:12 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 20 Apr 2023 10:35:11 +0000 (12:35 +0200)
commitcec44fdfbdd6a8cc834896dd88df4b9f847836e9
tree6e9db6e79ef4a8f68bf6ad62966d99429369226e
parent09b1f40a4ea271b3676704f47d85483df5b76b7b
block: ublk_drv: mark device as LIVE before adding disk

[ Upstream commit 4985e7b2c002eb4c5c794a1d3acd91b82c89a0fd ]

IO can be started before add_disk() returns, such as reading parititon table,
then the monitor work should work for making forward progress.

So mark device as LIVE before adding disk, meantime change to
DEAD if add_disk() fails.

Fixed: 71f28f3136af ("ublk_drv: add io_uring based userspace block driver")
Reviewed-by: Ziyang Zhang <ZiyangZhang@linux.alibaba.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20230318141231.55562-1-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/block/ublk_drv.c