diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 4a7f1a349998..c94b8b6ab024 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -620,6 +620,11 @@ static ssize_t queue_wb_lat_store(struct gendisk *disk, const char *page, if (val < -1) return -EINVAL; + /* + * Ensure that the queue is idled, in case the latency update + * ends up either enabling or disabling wbt completely. We can't + * have IO inflight if that happens. + */ memflags = blk_mq_freeze_queue(q); rqos = wbt_rq_qos(q); @@ -638,11 +643,6 @@ static ssize_t queue_wb_lat_store(struct gendisk *disk, const char *page, if (wbt_get_min_lat(q) == val) goto out; - /* - * Ensure that the queue is idled, in case the latency update - * ends up either enabling or disabling wbt completely. We can't - * have IO inflight if that happens. - */ blk_mq_quiesce_queue(q); mutex_lock(&disk->rqos_state_mutex);