From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CD1FC433F5 for ; Wed, 3 Nov 2021 03:44:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CC51261058 for ; Wed, 3 Nov 2021 03:44:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CC51261058 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dAYJx74U+GdQXr+dAoKOA4zqw8371ITy4X5feU72lkI=; b=FENA1wnKUu7ShD4KyQivx1tcFb ff1NL+cFSK5BvnPVIpJGdZgId7KAMGf97a8MzWQr1Sxl9Q6QnpNRsmVjyJha5n92E7yLrY1cRJEZu Ykew0ytc8o5rMMIf0ANOeUQzINcZpJWwaASzP8DyPoOcXsYq1II12/i52Vs5dPDgMsJIcEdGrpm6A t46ZPzAP4ARSYArQOA8OWGFGq0zWYMVyhLYgX5wAzdcHwEi1mVDMA2FjyqImQnmJTifP+xZH45fjt 4N77dwHHbM754/a2tt6+mn59FCRcAga1VtIag7N4ih+VbOkUzl7lXhDadEclFKtwtxAjES3h/9IRV 5ys8tGmw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mi7Cl-003z4w-SC; Wed, 03 Nov 2021 03:44:51 +0000 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mi7CV-003yz0-Vz for linux-nvme@lists.infradead.org; Wed, 03 Nov 2021 03:44:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635911075; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dAYJx74U+GdQXr+dAoKOA4zqw8371ITy4X5feU72lkI=; b=Qr5GmrUcgfoBPEU0Qr0zhXX3QQlu84a9OgTsvhhhMhykr7DiD4FMKirXM/06Um6fuEMQYW G2dpCZc/GEQWmzmhG6SDKzWLXh7PdoFD6qLBDBsdVpgJSZSkR2HfwefT+KEh8hKaKUCGmE 1itGATGEOjBcK2h2hvAHLrIZ8UJpUSM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-365-hE6ypDbqM0i1blHUz4Pm-A-1; Tue, 02 Nov 2021 23:44:31 -0400 X-MC-Unique: hE6ypDbqM0i1blHUz4Pm-A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 718AF1006AA3; Wed, 3 Nov 2021 03:44:30 +0000 (UTC) Received: from localhost (ovpn-8-17.pek2.redhat.com [10.72.8.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9DB9E5C1BB; Wed, 3 Nov 2021 03:44:23 +0000 (UTC) From: Ming Lei To: Jens Axboe Cc: Yi Zhang , linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, "Martin K . Petersen" , linux-scsi@vger.kernel.org, James Bottomley , Ming Lei Subject: [PATCH 4/4] nvme: wait until quiesce is done Date: Wed, 3 Nov 2021 11:43:05 +0800 Message-Id: <20211103034305.3691555-5-ming.lei@redhat.com> In-Reply-To: <20211103034305.3691555-1-ming.lei@redhat.com> References: <20211103034305.3691555-1-ming.lei@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211102_204436_172007_2F6127BE X-CRM114-Status: GOOD ( 11.70 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org NVMe uses one atomic flag to check if quiesce is needed. If quiesce is started, the helper returns immediately. This way is wrong, since we have to wait until quiesce is done. Fixes: e70feb8b3e68 ("blk-mq: support concurrent queue quiesce/unquiesce") Signed-off-by: Ming Lei --- drivers/nvme/host/core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 838b5e2058be..4b5de8f5435a 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -4518,6 +4518,8 @@ static void nvme_stop_ns_queue(struct nvme_ns *ns) { if (!test_and_set_bit(NVME_NS_STOPPED, &ns->flags)) blk_mq_quiesce_queue(ns->queue); + else + blk_mq_wait_quiesce_done(ns->queue); } /* @@ -4637,6 +4639,8 @@ void nvme_stop_admin_queue(struct nvme_ctrl *ctrl) { if (!test_and_set_bit(NVME_CTRL_ADMIN_Q_STOPPED, &ctrl->flags)) blk_mq_quiesce_queue(ctrl->admin_q); + else + blk_mq_wait_quiesce_done(ctrl->admin_q); } EXPORT_SYMBOL_GPL(nvme_stop_admin_queue); -- 2.31.1