Skip to content

Commit

Permalink
blk-throttle: improve queue bypass handling
Browse files Browse the repository at this point in the history
If a queue is bypassing, all blkcg policies should become noops but
blk-throttle wasn't.  It only became noop if the queue was dying.
While this wouldn't lead to an oops as falling back to the root blkg
is safe in this case, this can be a bit surprising - a bypassing queue
could still be applying throttle limits.

Fix it by removing blk_queue_dying() test in throtl_lookup_create_tg()
and testing blk_queue_bypass() in blk_throtl_bio() and bypassing
before doing anything else.

Signed-off-by: Tejun Heo <[email protected]>
Cc: Vivek Goyal <[email protected]>
Cc: Arianna Avanzini <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
htejun authored and axboe committed Aug 18, 2015
1 parent 85b6bc9 commit c9589f0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions block/blk-throttle.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ static struct throtl_grp *throtl_lookup_create_tg(struct throtl_data *td,
/* if %NULL and @q is alive, fall back to root_tg */
if (!IS_ERR(blkg))
tg = blkg_to_tg(blkg);
else if (!blk_queue_dying(q))
else
tg = td_root_tg(td);
}

Expand Down Expand Up @@ -1438,10 +1438,11 @@ bool blk_throtl_bio(struct request_queue *q, struct bio *bio)
* IO group
*/
spin_lock_irq(q->queue_lock);
tg = throtl_lookup_create_tg(td, blkcg);
if (unlikely(!tg))

if (unlikely(blk_queue_bypass(q)))
goto out_unlock;

tg = throtl_lookup_create_tg(td, blkcg);
sq = &tg->service_queue;

while (true) {
Expand Down

0 comments on commit c9589f0

Please sign in to comment.