From: Hannes Reinecke Date: Wed, 26 May 2021 15:23:17 +0000 (+0200) Subject: nvme-loop: check for NVME_LOOP_Q_LIVE in nvme_loop_destroy_admin_queue() X-Git-Tag: v5.10.79~3628 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=155c2fea4b31fc0ca5b3028c1ceea03c49ec8884;p=platform%2Fkernel%2Flinux-rpi.git nvme-loop: check for NVME_LOOP_Q_LIVE in nvme_loop_destroy_admin_queue() [ Upstream commit 4237de2f73a669e4f89ac0aa2b44fb1a1d9ec583 ] We need to check the NVME_LOOP_Q_LIVE flag in nvme_loop_destroy_admin_queue() to protect against duplicate invocations eg during concurrent reset and remove calls. Signed-off-by: Hannes Reinecke Reviewed-by: Chaitanya Kulkarni Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c index c07b4a1..df0e528 100644 --- a/drivers/nvme/target/loop.c +++ b/drivers/nvme/target/loop.c @@ -251,7 +251,8 @@ static const struct blk_mq_ops nvme_loop_admin_mq_ops = { static void nvme_loop_destroy_admin_queue(struct nvme_loop_ctrl *ctrl) { - clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[0].flags); + if (!test_and_clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[0].flags)) + return; nvmet_sq_destroy(&ctrl->queues[0].nvme_sq); blk_cleanup_queue(ctrl->ctrl.admin_q); blk_cleanup_queue(ctrl->ctrl.fabrics_q);