Message ID | 20230307141520.793891-7-ming.lei@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | io_uring/ublk: add IORING_OP_FUSED_CMD | expand |
On 2023/3/7 22:15, Ming Lei wrote: > 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. > > Reviewed-by: Ziyang Zhang <ZiyangZhang@linux.alibaba.com> > Signed-off-by: Ming Lei <ming.lei@redhat.com> > --- Hi Ming, Without this patch, if we fail to read partition table(Could this happen?)and EIO is returned, then START_DEV may hang forever, right? I may have encountered such error before and I think this bug is introduced by: bbae8d1f526b(ublk_drv: consider recovery feature in aborting mechanism) which change the behavior of monitor_work. So shall we add a fixes tag, such as: Fixes: bbae8d1f526b("ublk_drv: consider recovery feature in aborting mechanism") Regards, Zhang
On Wed, Mar 08, 2023 at 11:48:15AM +0800, Ziyang Zhang wrote: > On 2023/3/7 22:15, Ming Lei wrote: > > 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. > > > > Reviewed-by: Ziyang Zhang <ZiyangZhang@linux.alibaba.com> > > Signed-off-by: Ming Lei <ming.lei@redhat.com> > > --- > > Hi Ming, > > Without this patch, if we fail to read partition table(Could this > happen?)and EIO is returned, then START_DEV may hang forever, right? > I may have encountered such error before and I think this bug is introduced > by: > bbae8d1f526b(ublk_drv: consider recovery feature in aborting mechanism) > which change the behavior of monitor_work. So shall we add a fixes tag, such > as: > Fixes: bbae8d1f526b("ublk_drv: consider recovery feature in aborting mechanism") Even without the above commit, monitor work still may not be started because of ub->dev_info.state == UBLK_S_DEV_DEAD. thanks, Ming
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index 088d9efffe6b..2778c14a8407 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -1605,17 +1605,18 @@ static int ublk_ctrl_start_dev(struct ublk_device *ub, struct io_uring_cmd *cmd) set_bit(GD_SUPPRESS_PART_SCAN, &disk->state); get_device(&ub->cdev_dev); + ub->dev_info.state = UBLK_S_DEV_LIVE; ret = add_disk(disk); if (ret) { /* * Has to drop the reference since ->free_disk won't be * called in case of add_disk failure. */ + ub->dev_info.state = UBLK_S_DEV_DEAD; ublk_put_device(ub); goto out_put_disk; } set_bit(UB_STATE_USED, &ub->state); - ub->dev_info.state = UBLK_S_DEV_LIVE; out_put_disk: if (ret) put_disk(disk);