Skip to content

Commit

Permalink
block, bfq-mq: turn BUG_ON on request-size into WARN_ON
Browse files Browse the repository at this point in the history
BFQ has many checks of internal and external consistency. One of them
checks that an I/O request has still sectors to serve, if it happens
to be retired without being served. If the request has no sector to
serve, a BUG_ON signals the failure and causes the kernel to
terminate. Yet, from a crash report by a user [1], this condition may
happen to hold, in apparently correct functioning, for I/O with a
CD/DVD.

To address this issue, this commit turns the above BUG_ON into a
WARN_ON. This commit also adds a companion WARN_ON on request
insertion into the scheduler.

[1] https://groups.google.com/d/msg/bfq-iosched/DDOTJBroBa4/VyU1zUFtCgAJ

Reported-by: Alexandre Frade <admfrade@gmail.com>
Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
  • Loading branch information
Algodev-github committed Nov 14, 2017
1 parent 7352e96 commit 344b0aa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion block/bfq-mq-iosched.c
Expand Up @@ -1540,6 +1540,8 @@ static void bfq_add_request(struct request *rq)


BUG_ON(!RQ_BFQQ(rq)); BUG_ON(!RQ_BFQQ(rq));
BUG_ON(RQ_BFQQ(rq) != bfqq); BUG_ON(RQ_BFQQ(rq) != bfqq);
WARN_ON(blk_rq_sectors(rq) == 0);

elv_rb_add(&bfqq->sort_list, rq); elv_rb_add(&bfqq->sort_list, rq);


/* /*
Expand Down Expand Up @@ -4962,7 +4964,7 @@ static void bfq_finish_request(struct request *rq)
rq_io_start_time_ns(rq), rq_io_start_time_ns(rq),
rq->cmd_flags); rq->cmd_flags);


BUG_ON(blk_rq_sectors(rq) == 0 && !(rq->rq_flags & RQF_STARTED)); WARN_ON(blk_rq_sectors(rq) == 0 && !(rq->rq_flags & RQF_STARTED));


if (likely(rq->rq_flags & RQF_STARTED)) { if (likely(rq->rq_flags & RQF_STARTED)) {
unsigned long flags; unsigned long flags;
Expand Down

0 comments on commit 344b0aa

Please sign in to comment.