Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp889088pxj; Wed, 16 Jun 2021 16:23:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhZiQpKZzj4/IUiNYTkHrttCt53BzBkVR7Si1N/27ME3YBkmqoz0Ig6ADtbzcB1iEFd1cX X-Received: by 2002:a92:c152:: with SMTP id b18mr1388390ilh.282.1623885791393; Wed, 16 Jun 2021 16:23:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623885791; cv=none; d=google.com; s=arc-20160816; b=A1ozQwBvpUqzjLpD86ixIB2/2drK+xDjngQtBQ8re5WmCJuPTwvkXG/zmc2Yj/VxNp 3yGyHqCgHl8M3DphUKziiWg+rR5hMXe4hAK+c4dnzK11bPzOUF3uBMtQy+qhahfOVd6D NiG6pECdPEVDC1cQYDtr7+3N/IBjzjEJlC5itgcJ6A6lRDObrdyZEIt/h0cb7k8PjLtP qTWcujfdXNebJoOAvqf3s0uyvwSjwru/kMAGpRRYQgzXVbQUowJH1U3d7FkNeldY7x6O wGQHYRmkAAVYX943vL4qi1Km9ogV4NEUQo4LU5rQ8/5xyWsYmjlifCgi5fl6jHSs72TV T2/A== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2a3OvMO/Ic4/8M4AkDMWt9U8nyCVehXNIbcrqVSwAps=; b=Nm9hyO9gxujF0r6ow+dPz1w3HE4kyq0TDNRjBZqIf/JlH9E3wile0RbZSSrbjUsyq7 5blsdPJh0d6G0BJjddaVq6ps1CcpWIVPY3EPU4izwnGMPjAx81T7PSEceDFlrb3xeAzu Eopqmo76AoOM+/M1rTaym7RhU7Jp9j/1mOn4+MFbEtQuTv+bH0Aj0pqxi4GpSlERoCmU A3MqaC4+7RFtJUyMiMcBnAn2+Cbf95k1b4Wm3X2enSHvZNe4bB9KQnpMO7pdIlG+mobP e2zGAXBYlZOSxHGct1WeED2ozKFDOq/of5lYlSJl2jYd53aiLX0jriN/wxqw2K0UENpC JXwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RcYQqCT8; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t22si3710675ioh.104.2021.06.16.16.22.59; Wed, 16 Jun 2021 16:23:11 -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=@linuxfoundation.org header.s=korg header.b=RcYQqCT8; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235581AbhFPPpd (ORCPT + 99 others); Wed, 16 Jun 2021 11:45:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:56158 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235285AbhFPPme (ORCPT ); Wed, 16 Jun 2021 11:42:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3ADC5613E9; Wed, 16 Jun 2021 15:38:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623857896; bh=P5ycT09ZcXhZUQODqUPfMBH6y1mKQAUoeOI2dT/yBF8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RcYQqCT8KkcutG0a4s6PhJXP3ZnVkJJmquKicbqJyzbes+GHuzuPPbcFucfpqqc4n nX00FF1zpaV3hUtO2fO8Lr1nVFXQ+NVYDoFAylKOZTZPrl1XXZCsNVufReY+HXnhRZ +KfbLrrNd+F3xBrXcWv5AmVbU5LRYzo90w8WflrU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hannes Reinecke , Chaitanya Kulkarni , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.12 37/48] nvme-loop: check for NVME_LOOP_Q_LIVE in nvme_loop_destroy_admin_queue() Date: Wed, 16 Jun 2021 17:33:47 +0200 Message-Id: <20210616152837.821140040@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210616152836.655643420@linuxfoundation.org> References: <20210616152836.655643420@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 c34f785e699d..fe14609d2254 100644 --- a/drivers/nvme/target/loop.c +++ b/drivers/nvme/target/loop.c @@ -261,7 +261,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); -- 2.30.2