Skip to content

Commit c9589f0

Browse files
htejunaxboe
authored andcommitted
blk-throttle: improve queue bypass handling
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 <tj@kernel.org> Cc: Vivek Goyal <vgoyal@redhat.com> Cc: Arianna Avanzini <avanzini.arianna@gmail.com> Signed-off-by: Jens Axboe <axboe@fb.com>
1 parent 85b6bc9 commit c9589f0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

block/blk-throttle.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ static struct throtl_grp *throtl_lookup_create_tg(struct throtl_data *td,
475475
/* if %NULL and @q is alive, fall back to root_tg */
476476
if (!IS_ERR(blkg))
477477
tg = blkg_to_tg(blkg);
478-
else if (!blk_queue_dying(q))
478+
else
479479
tg = td_root_tg(td);
480480
}
481481

@@ -1438,10 +1438,11 @@ bool blk_throtl_bio(struct request_queue *q, struct bio *bio)
14381438
* IO group
14391439
*/
14401440
spin_lock_irq(q->queue_lock);
1441-
tg = throtl_lookup_create_tg(td, blkcg);
1442-
if (unlikely(!tg))
1441+
1442+
if (unlikely(blk_queue_bypass(q)))
14431443
goto out_unlock;
14441444

1445+
tg = throtl_lookup_create_tg(td, blkcg);
14451446
sq = &tg->service_queue;
14461447

14471448
while (true) {

0 commit comments

Comments
 (0)