summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2021-05-26 17:23:17 +0200
committerSasha Levin <sashal@kernel.org>2021-06-30 08:48:12 -0400
commit9ccbe18eb48a9b27b646931e01d84dfe0bc8a10d (patch)
treefa72fb568cf2ab23f80314e35596690d25dee198
parentef244ccfd1c213fa8c05b58b6760640718e9b636 (diff)
downloadlinux-stable-9ccbe18eb48a9b27b646931e01d84dfe0bc8a10d.tar.gz
linux-stable-9ccbe18eb48a9b27b646931e01d84dfe0bc8a10d.tar.bz2
linux-stable-9ccbe18eb48a9b27b646931e01d84dfe0bc8a10d.zip
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 <hare@suse.de> Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/nvme/target/loop.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c
index dba0b0145f48..08b52f3ed0c3 100644
--- a/drivers/nvme/target/loop.c
+++ b/drivers/nvme/target/loop.c
@@ -274,7 +274,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_mq_free_tag_set(&ctrl->admin_tag_set);