]> git.baikalelectronics.ru Git - kernel.git/commit
block, bfq: move update of waker and woken list to queue freeing
authorPaolo Valente <paolo.valente@linaro.org>
Wed, 7 Aug 2019 14:17:54 +0000 (16:17 +0200)
committerJens Axboe <axboe@kernel.dk>
Thu, 8 Aug 2019 13:30:52 +0000 (07:30 -0600)
commita9cdc04673ef951d4688d0d06ebc5b23cce8f3fd
tree25fa18af9d966e3f30ad409b51190e61a205fad3
parente5e1df73ebe2af39ad58437d61d752c0e13b2152
block, bfq: move update of waker and woken list to queue freeing

Since commit 2b24cd45e88e ("block, bfq: detect wakers and
unconditionally inject their I/O"), every bfq_queue has a pointer to a
waker bfq_queue and a list of the bfq_queues it may wake. In this
respect, when a bfq_queue, say Q, remains with no I/O source attached
to it, Q cannot be woken by any other bfq_queue, and cannot wake any
other bfq_queue. Then Q must be removed from the woken list of its
possible waker bfq_queue, and all bfq_queues in the woken list of Q
must stop having a waker bfq_queue.

Q remains with no I/O source in two cases: when the last process
associated with Q exits or when such a process gets associated with a
different bfq_queue. Unfortunately, commit 2b24cd45e88e ("block, bfq:
detect wakers and unconditionally inject their I/O") performed the
above updates only in the first case.

This commit fixes this bug by moving these updates to when Q gets
freed. This is a simple and safe way to handle all cases, as both the
above events, process exit and re-association, lead to Q being freed
soon, and because dangling references would come out only after Q gets
freed (if no update were performed).

Fixes: 2b24cd45e88e ("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