Message ID | 20220824054744.77812-10-ZiyangZhang@linux.alibaba.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ublk_drv: add USER_RECOVERY support | expand |
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index ccaf3761de74..f8bb2e818d33 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -1435,7 +1435,8 @@ static int ublk_ctrl_start_dev(struct io_uring_cmd *cmd) wait_for_completion_interruptible(&ub->completion); - schedule_delayed_work(&ub->monitor_work, UBLK_DAEMON_MONITOR_PERIOD); + if (!ublk_can_use_recovery(ub)) + schedule_delayed_work(&ub->monitor_work, UBLK_DAEMON_MONITOR_PERIOD); mutex_lock(&ub->mutex); if (ub->dev_info.state != UBLK_S_DEV_DEAD ||
monitor_work is used to end(abort) all dying ubqs and cleanup device. With recovery feature enabled, we reinit dying ubqs in START_USER_RECOVERY command and we do not cleanup ublk device. So scheduling monitor_work in START_DEV is unnecessary. We manually schedule monitor_work in STOP_DEV regardless reocvery feature is enabled or not. So we can cleanup everything in the end. Signed-off-by: ZiyangZhang <ZiyangZhang@linux.alibaba.com> --- drivers/block/ublk_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)