blk-mq: fix race condition in active queue accounting
authorTian Lan <tian.lan@twosigma.com>
Mon, 22 May 2023 21:05:55 +0000 (17:05 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Jun 2023 07:26:19 +0000 (09:26 +0200)
commit6793a3c6326eb3769a99e52908b22df8786776f9
treeac8d4047e21ffbea101e694029725fff69946f34
parentfe735073a50eaa71aceb2e990827fe26f33cddd6
blk-mq: fix race condition in active queue accounting

[ Upstream commit 3e94d54e83cafd2b562bb6d15bb2f72d76200fb5 ]

If multiple CPUs are sharing the same hardware queue, it can
cause leak in the active queue counter tracking when __blk_mq_tag_busy()
is executed simultaneously.

Fixes: ee78ec1077d3 ("blk-mq: blk_mq_tag_busy is no need to return a value")
Signed-off-by: Tian Lan <tian.lan@twosigma.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20230522210555.794134-1-tilan7663@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
block/blk-mq-tag.c