blk-iolatency: error out if blk_get_queue() failed in iolatency_set_limit()
authorYu Kuai <yukuai3@huawei.com>
Thu, 5 Aug 2021 12:46:45 +0000 (20:46 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Aug 2021 11:22:08 +0000 (13:22 +0200)
commit821e6a61335443cd3d56c85427c7f950cb4fd551
tree284b4feb38cd044b93692fae4aafca08599765be
parentc5a499b8607a65570170e5df6276e40756f34ab5
blk-iolatency: error out if blk_get_queue() failed in iolatency_set_limit()

[ Upstream commit 8d75d0eff6887bcac7225e12b9c75595e523d92d ]

If queue is dying while iolatency_set_limit() is in progress,
blk_get_queue() won't increment the refcount of the queue. However,
blk_put_queue() will still decrement the refcount later, which will
cause the refcout to be unbalanced.

Thus error out in such case to fix the problem.

Fixes: 8c772a9bfc7c ("blk-iolatency: fix IO hang due to negative inflight counter")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/20210805124645.543797-1-yukuai3@huawei.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
block/blk-iolatency.c