summaryrefslogtreecommitdiffstats
path: root/block/bfq-iosched.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-06-16 12:15:24 -0400
committerJens Axboe <axboe@kernel.dk>2017-06-18 12:08:55 -0400
commit9f2107382636cf9a71951eb71ec04f2fb3641b37 (patch)
tree39a0ef4899d6a9ea48a3a1637b1c86a6071f6dab /block/bfq-iosched.c
parent037cebb85b94027a52be69d72068e6f6d0dca3a3 (diff)
bfq-iosched: fix NULL ioc check in bfq_get_rq_private
icq_to_bic is a container_of operation, so we need to check for NULL before it. Also move the check outside the spinlock while we're at it. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/bfq-iosched.c')
-rw-r--r--block/bfq-iosched.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index 4f69e39c2f89..f037b005faa1 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -4398,16 +4398,17 @@ static int bfq_get_rq_private(struct request_queue *q, struct request *rq,
4398 struct bio *bio) 4398 struct bio *bio)
4399{ 4399{
4400 struct bfq_data *bfqd = q->elevator->elevator_data; 4400 struct bfq_data *bfqd = q->elevator->elevator_data;
4401 struct bfq_io_cq *bic = icq_to_bic(rq->elv.icq); 4401 struct bfq_io_cq *bic;
4402 const int is_sync = rq_is_sync(rq); 4402 const int is_sync = rq_is_sync(rq);
4403 struct bfq_queue *bfqq; 4403 struct bfq_queue *bfqq;
4404 bool new_queue = false; 4404 bool new_queue = false;
4405 bool split = false; 4405 bool split = false;
4406 4406
4407 spin_lock_irq(&bfqd->lock); 4407 if (!rq->elv.icq)
4408 return 1;
4409 bic = icq_to_bic(rq->elv.icq);
4408 4410
4409 if (!bic) 4411 spin_lock_irq(&bfqd->lock);
4410 goto queue_fail;
4411 4412
4412 bfq_check_ioprio_change(bic, bio); 4413 bfq_check_ioprio_change(bic, bio);
4413 4414
@@ -4465,13 +4466,7 @@ static int bfq_get_rq_private(struct request_queue *q, struct request *rq,
4465 bfq_handle_burst(bfqd, bfqq); 4466 bfq_handle_burst(bfqd, bfqq);
4466 4467
4467 spin_unlock_irq(&bfqd->lock); 4468 spin_unlock_irq(&bfqd->lock);
4468
4469 return 0; 4469 return 0;
4470
4471queue_fail:
4472 spin_unlock_irq(&bfqd->lock);
4473
4474 return 1;
4475} 4470}
4476 4471
4477static void bfq_idle_slice_timer_body(struct bfq_queue *bfqq) 4472static void bfq_idle_slice_timer_body(struct bfq_queue *bfqq)