block, bfq: reset last_completed_rq_bfqq if the pointed queue is freed
authorPaolo Valente <paolo.valente@linaro.org>
Wed, 7 Aug 2019 14:17:53 +0000 (16:17 +0200)
committerJens Axboe <axboe@kernel.dk>
Thu, 8 Aug 2019 13:30:50 +0000 (07:30 -0600)
commit08d383a74948b43eb6e96c86153e63cbf276f1fa
tree7b893061ad7cee76de8e1b868b0c23ed45200ffc
parent430380b4637aec646996b4aef67ad417593923b2
block, bfq: reset last_completed_rq_bfqq if the pointed queue is freed

Since commit 13a857a4c4e8 ("block, bfq: detect wakers and
unconditionally inject their I/O"), BFQ stores, in a per-device
pointer last_completed_rq_bfqq, the last bfq_queue that had an I/O
request completed. If some bfq_queue receives new I/O right after the
last request of last_completed_rq_bfqq has been completed, then
last_completed_rq_bfqq may be a waker bfq_queue.

But if the bfq_queue last_completed_rq_bfqq points to is freed, then
last_completed_rq_bfqq becomes a dangling reference. This commit
resets last_completed_rq_bfqq if the pointed bfq_queue is freed.

Fixes: 13a857a4c4e8 ("block, bfq: detect wakers and unconditionally inject their I/O")
Reported-by: Douglas Anderson <dianders@chromium.org>
Tested-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bfq-iosched.c