mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-01 02:36:02 +00:00
block: BFQ: Add several invariant checks
If anything goes wrong with the counters that track the number of requests, I/O locks up. Make such scenarios easier to debug by adding invariant checks for the request counters. Additionally, check that BFQ queues are empty before these are freed. Cc: Jan Kara <jack@suse.cz> Cc: Yu Kuai <yukuai3@huawei.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230516223853.1385255-1-bvanassche@acm.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
a036e698c2
commit
3e49c1e4a6
@ -5403,6 +5403,9 @@ void bfq_put_queue(struct bfq_queue *bfqq)
|
|||||||
if (bfqq->bfqd->last_completed_rq_bfqq == bfqq)
|
if (bfqq->bfqd->last_completed_rq_bfqq == bfqq)
|
||||||
bfqq->bfqd->last_completed_rq_bfqq = NULL;
|
bfqq->bfqd->last_completed_rq_bfqq = NULL;
|
||||||
|
|
||||||
|
WARN_ON_ONCE(!list_empty(&bfqq->fifo));
|
||||||
|
WARN_ON_ONCE(!RB_EMPTY_ROOT(&bfqq->sort_list));
|
||||||
|
|
||||||
kmem_cache_free(bfq_pool, bfqq);
|
kmem_cache_free(bfq_pool, bfqq);
|
||||||
bfqg_and_blkg_put(bfqg);
|
bfqg_and_blkg_put(bfqg);
|
||||||
}
|
}
|
||||||
@ -7135,6 +7138,7 @@ static void bfq_exit_queue(struct elevator_queue *e)
|
|||||||
{
|
{
|
||||||
struct bfq_data *bfqd = e->elevator_data;
|
struct bfq_data *bfqd = e->elevator_data;
|
||||||
struct bfq_queue *bfqq, *n;
|
struct bfq_queue *bfqq, *n;
|
||||||
|
unsigned int actuator;
|
||||||
|
|
||||||
hrtimer_cancel(&bfqd->idle_slice_timer);
|
hrtimer_cancel(&bfqd->idle_slice_timer);
|
||||||
|
|
||||||
@ -7143,6 +7147,11 @@ static void bfq_exit_queue(struct elevator_queue *e)
|
|||||||
bfq_deactivate_bfqq(bfqd, bfqq, false, false);
|
bfq_deactivate_bfqq(bfqd, bfqq, false, false);
|
||||||
spin_unlock_irq(&bfqd->lock);
|
spin_unlock_irq(&bfqd->lock);
|
||||||
|
|
||||||
|
for (actuator = 0; actuator < bfqd->num_actuators; actuator++)
|
||||||
|
WARN_ON_ONCE(bfqd->rq_in_driver[actuator]);
|
||||||
|
WARN_ON_ONCE(bfqd->tot_rq_in_driver);
|
||||||
|
WARN_ON_ONCE(bfqq->dispatched);
|
||||||
|
|
||||||
hrtimer_cancel(&bfqd->idle_slice_timer);
|
hrtimer_cancel(&bfqd->idle_slice_timer);
|
||||||
|
|
||||||
/* release oom-queue reference to root group */
|
/* release oom-queue reference to root group */
|
||||||
|
Loading…
Reference in New Issue
Block a user