Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp604059pxj; Tue, 18 May 2021 10:04:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGLhAsAs+lSwGdIqoim51UX2MvZvcJrdQs1hMDaLjP0Bz5qhdJC/SJFmyAdlS6vCrptg0n X-Received: by 2002:a92:c951:: with SMTP id i17mr5174282ilq.198.1621357490732; Tue, 18 May 2021 10:04:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621357490; cv=none; d=google.com; s=arc-20160816; b=ciyJC0gxP+vUSNrjNnLiE2kgpyEOzfc1fOS1w0l6dhb/wm7Z+pPmdHoSfADhMaf3mb wKB6e5SOcf+AnVro4dk3IhdImPY4vxSgSfVBE2R5mQyJ1zDhf+Xv0xRumyJ3ep2JziK3 5ys5rFzXoDDLOZTXX+MXikwN/fjov123HzD/djIG288/dKh5RLwcaEZU5EagQKncp8Gj YAuAV/7az/Q3AmdNombC8EN3tixv278OKerzDKgiA7AUK5/W+OdZSFMfZQbK2vhKqX7H uHmd2pQ4N6F3eHQCHCQG/e/PGL9R0aPQpg10MFZS0mF5fbwtSdLK5W6GQ31omhN1T8xV muMA== 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=K5EkOsQ4G3RG5jhgdSshVK2OkLVbIXke5HyQxuOYiXg=; b=FgRC2gXwkr5HsgCEm8l4FebdPknil3Xo7cfJp0PCH9qqVw03f/1X4Mj0xU2GkqeZ9F ABwS1GMj0/jDdEBAovVfC1SXxQZ4VmCQUNRBlVkeHAxHjeFCplJGdbfS2dd59YAPCo3g 84Xwc2WYKYaOuKLFQIf1rIZMT3EQ2qYBpr28MWrWcpcDYpJMYE2jxVY5Rh06c6F49mw8 4CQiAliEcn0JqXn0VX1eEM467me1FYw7rv+1vFe5LAEYeXt9RL1PqDGqjA3jMsM4VOmB nhM8XcgTXIPbbz8q6unaNji0KZvEND/qYTsIhBsgJPo+kL8t+qk0CQr7a7Ja2fio33kW PRfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QjBeVtt8; 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 n2si20167287ilm.161.2021.05.18.10.04.30; Tue, 18 May 2021 10:04:50 -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=QjBeVtt8; 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 S1343784AbhEQQIf (ORCPT + 99 others); Mon, 17 May 2021 12:08:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:36648 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344754AbhEQPph (ORCPT ); Mon, 17 May 2021 11:45:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2925561D33; Mon, 17 May 2021 14:43:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262631; bh=eLuid/kmF5F4tnB7tm+GcJuM4d6wwcP0W5n7vKBwE4s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QjBeVtt8wAvDmx8AkX66Kc9VWEySSB8xOfn0Tb6gIFcHwv0Pm2/uBfjDntmiCf4Lv hokR6k1EpWIqotM18v99c/ahPbz6Bmipvg73H9X487h115tWe4Zwvme0YumeksgeA/ WMS7qIZXcnG1ebZGORiSnto0iEd7vRGBZ8v4PP1U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Ming Lei , Hannes Reinecke , Bart Van Assche , Jens Axboe , Sasha Levin Subject: [PATCH 5.10 239/289] blk-mq: Swap two calls in blk_mq_exit_queue() Date: Mon, 17 May 2021 16:02:44 +0200 Message-Id: <20210517140313.212672297@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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: Bart Van Assche [ Upstream commit 630ef623ed26c18a457cdc070cf24014e50129c2 ] If a tag set is shared across request queues (e.g. SCSI LUNs) then the block layer core keeps track of the number of active request queues in tags->active_queues. blk_mq_tag_busy() and blk_mq_tag_idle() update that atomic counter if the hctx flag BLK_MQ_F_TAG_QUEUE_SHARED is set. Make sure that blk_mq_exit_queue() calls blk_mq_tag_idle() before that flag is cleared by blk_mq_del_queue_tag_set(). Cc: Christoph Hellwig Cc: Ming Lei Cc: Hannes Reinecke Fixes: 0d2602ca30e4 ("blk-mq: improve support for shared tags maps") Signed-off-by: Bart Van Assche Reviewed-by: Ming Lei Link: https://lore.kernel.org/r/20210513171529.7977-1-bvanassche@acm.org Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- block/blk-mq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 4cd623a7383c..4bf9449b4586 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -3256,10 +3256,12 @@ EXPORT_SYMBOL(blk_mq_init_allocated_queue); /* tags can _not_ be used after returning from blk_mq_exit_queue */ void blk_mq_exit_queue(struct request_queue *q) { - struct blk_mq_tag_set *set = q->tag_set; + struct blk_mq_tag_set *set = q->tag_set; - blk_mq_del_queue_tag_set(q); + /* Checks hctx->flags & BLK_MQ_F_TAG_QUEUE_SHARED. */ blk_mq_exit_hw_queues(q, set, set->nr_hw_queues); + /* May clear BLK_MQ_F_TAG_QUEUE_SHARED in hctx->flags. */ + blk_mq_del_queue_tag_set(q); } static int __blk_mq_alloc_rq_maps(struct blk_mq_tag_set *set) -- 2.30.2