It is no need do finish_wait twice after acquiring inflight. Signed-off-by: Guo Xuenan <guoxuenan@xxxxxxxxxx> --- block/blk-rq-qos.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/block/blk-rq-qos.c b/block/blk-rq-qos.c index 656460636ad3..00a08e53dc24 100644 --- a/block/blk-rq-qos.c +++ b/block/blk-rq-qos.c @@ -270,8 +270,10 @@ void rq_qos_wait(struct rq_wait *rqw, void *private_data, has_sleeper = !wq_has_single_sleeper(&rqw->wait); do { /* The memory barrier in set_task_state saves us here. */ - if (data.got_token) - break; + if (data.got_token) { + finish_wait(&rqw->wait, &data.wq); + return; + } if (!has_sleeper && acquire_inflight_cb(rqw, private_data)) { finish_wait(&rqw->wait, &data.wq); @@ -289,7 +291,6 @@ void rq_qos_wait(struct rq_wait *rqw, void *private_data, has_sleeper = true; set_current_state(TASK_UNINTERRUPTIBLE); } while (1); - finish_wait(&rqw->wait, &data.wq); } void rq_qos_exit(struct request_queue *q) -- 2.25.4