bfq: Remove merged request already in bfq_requests_merged()
authorJan Kara <jack@suse.cz>
Wed, 23 Jun 2021 09:36:33 +0000 (11:36 +0200)
committerJens Axboe <axboe@kernel.dk>
Fri, 25 Jun 2021 00:43:54 +0000 (18:43 -0600)
commita921c655f2033dd1ce1379128efe881dda23ea37
tree2061a6654f80b0254d23e76cca6d172079dd9dad
parent0384264ea8a39bd98c9a3158060565f650c056a6
bfq: Remove merged request already in bfq_requests_merged()

Currently, bfq does very little in bfq_requests_merged() and handles all
the request cleanup in bfq_finish_requeue_request() called from
blk_mq_free_request(). That is currently safe only because
blk_mq_free_request() is called shortly after bfq_requests_merged()
while bfqd->lock is still held. However to fix a lock inversion between
bfqd->lock and ioc->lock, we need to call blk_mq_free_request() after
dropping bfqd->lock. That would mean that already merged request could
be seen by other processes inside bfq queues and possibly dispatched to
the device which is wrong. So move cleanup of the request from
bfq_finish_requeue_request() to bfq_requests_merged().

Acked-by: Paolo Valente <paolo.valente@linaro.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20210623093634.27879-2-jack@suse.cz
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bfq-iosched.c