Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3740997pxv; Mon, 28 Jun 2021 11:37:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkoTUglw6Dun8GUFAqHfaK2GR4Gtx+smQhx1Zh24X/8iguzFakRSmWd0bNbMLGwV6KggxX X-Received: by 2002:a92:200b:: with SMTP id j11mr8581188ile.183.1624905456873; Mon, 28 Jun 2021 11:37:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624905456; cv=none; d=google.com; s=arc-20160816; b=ZYZIrnhLcdukE1TG/YLvPWREYY2POn1UokXf49eAghJ/0krMWIh26m47Wv9H/Fzsfu /wAnURZXQMXJ0k/9zwrfC4XkecAEGYEeLsSQffgIMQbo2LUzdvk6yfUo2thW7V/5gw2s TW071puKiTN0Do+V4uZ79a/L43TgT3BC+YwYjs7NKbq4PHD1Eb2YC/112KlIUFllvtJ7 4GthJJ2iTNOf3quYJ4xsResk1LEqeLFvGKZbKv4J6wcamm34dZ10I8cMnKkFPYH2ma/z xpmtfoHt0jAD0CBIhKdhfSb04UeNzqbKQPpeiwaaPW7TRmH3/K3acHUhmHHumswKeUyY 1c/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=l5nLymMDwpf1aPAn8q0uG5D/+2GPdE2SBfzTRtEHeww=; b=bY7KSekJZSkm6UGLR2UyT3IhFBI46raLiymu0TGjZZ1mnVcogRnCmaNZeUryozklRS 48EVldWLtwpT9tEXcV8YO97P3nEhsk9HH7uWPwxjZaNbD2z5Ya8ZWMNcUPgsLdwb6igl Y4W/zpVqalZlxTpB5aMTmW+kZvny3vPDwUjeWSM5SqFuGZGnYPzkYR4lUwiIXSXdY57K Ar2O4rBgKNAc4Dgcmqk25JcDfAhAuGfLdSHyh4OiyqaxuDL6gWE6PScXZGTi26wdvakM EKp4Gt49GRvVISi73WyZlMPLDNTenQpDNm5yjkodX8BA6KLTlhRjCB0epdTRoylZewwd u4Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YhrOhd98; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m6si18250789iol.83.2021.06.28.11.37.25; Mon, 28 Jun 2021 11:37:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YhrOhd98; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235599AbhF1PIm (ORCPT + 99 others); Mon, 28 Jun 2021 11:08:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:55274 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235259AbhF1OsC (ORCPT ); Mon, 28 Jun 2021 10:48:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8DCB261CAE; Mon, 28 Jun 2021 14:36:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624891001; bh=KHivZezR9oMQs9gSBQACCCzHXGLWeaXo5az7edNEM6U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YhrOhd988U/TvJrI1z8APaSCah05ecXyouDFAv0EQh2+sbj5xIxAJ2pYr5kF4uj+I Lyf84KhQF8bi24/r9hPQN1OLWLAAxbNpw5hLGfULYDtQttOsQ5K6xCwNAZMqkx7w+D f4zBIPwCc5s9YbFT9Cf+p9yE1R1FgzKFvc1uSVlwnqLlKkSZ9+7u/E+QAEp5PKHkmG XsxiVYwZ253Fbc0FiQu8czY5HbIThdKTfJyrw1OZa+5J+bWBL/+a/iP0zU73lw5yS3 KuR3bNOJqLpSgzYdP9jGJwXdTkgyYPKp/eZyDYFILNEPaQ5C7bQcTWx7E2saEF6o+9 /iM+hLAj5TY7g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hannes Reinecke , Chaitanya Kulkarni , Christoph Hellwig , Sasha Levin Subject: [PATCH 4.14 12/88] nvme-loop: check for NVME_LOOP_Q_LIVE in nvme_loop_destroy_admin_queue() Date: Mon, 28 Jun 2021 10:35:12 -0400 Message-Id: <20210628143628.33342-13-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210628143628.33342-1-sashal@kernel.org> References: <20210628143628.33342-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.238-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.14.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.14.238-rc1 X-KernelTest-Deadline: 2021-06-30T14:36+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hannes Reinecke [ 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 --- drivers/nvme/target/loop.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c index 963d8de932d1..7a0a10777cd1 100644 --- a/drivers/nvme/target/loop.c +++ b/drivers/nvme/target/loop.c @@ -287,7 +287,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); -- 2.30.2