Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp136318pxj; Mon, 17 May 2021 23:12:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0GFwpeV5DaI+TD7qhbLGvTRfnCy+uzGHvK1JLXeiKi1Bk/shIDtdHHHI+S462mqXfxguu X-Received: by 2002:a17:906:63d2:: with SMTP id u18mr4408954ejk.186.1621318325098; Mon, 17 May 2021 23:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621318325; cv=none; d=google.com; s=arc-20160816; b=0RjTSlQeefSzW80qzbHsawjRlHKVlqFBK34RjLfX73NpqLT9rqSY0RJOPYVkx8QC0j aOtOJnmCLWbjzVwJYd9lpTxFdNfXx+0LC/BNOsXNIShvYVxnSTdhvs61QUOCavvNUmmm baIAsrdSW5etI7lMedzb18HAq+LCAvb33+m23z6UyMHpt9IEtT/VsTYaB6UjdY2yNrzm JlJgcszpe5P2JaI2g2YJcM+LslzrlkiuOobfkxUnmxdzTYVWEysqyLIzXaKXWQoJaXIC plGrKsqIUWRRcwrx1cZ/SQC+6z+VByPehSTOfUrGj+vSlKqctrReymXXYoxCPqX4eAth QL8A== 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=QQgJqivlw5C8UZv9UKYyGsMqguQFPdx5KyWyuQFF/YE=; b=bcC8efvI60If9c5zzq/bhgVqnR8gSnmP9iQvaYv0Vcq21OVXUiTGFyxc920cNfmapY q8Zdv1Vr5jBHwWaXprYxdce42Egv8lgIcnKaqb/OtsBdnjJwsSJtSyNGq3ErD+X9jWg2 EYO1quA7XjyFA6TTzNU6fpy0Myw39obFzbP+EEgAwMKII7srjmdSL8UXtJojIHwujCXi U87pPkDfhjZM3ytnjctVNXZzHpHmv1g3SJU7u42soJtNTBXJh34Ms+rf1aU3nli/NQ2R mogyguE2LpwrrIHFMROr/dskXzZmEUs2mjMDTD3nGFkTBWdPaqMJPpD2IEp6QGHlLepJ 5pTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qKa8ZbY6; 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 k18si15284112edx.427.2021.05.17.23.10.46; Mon, 17 May 2021 23:12:05 -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=qKa8ZbY6; 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 S241244AbhEQOsL (ORCPT + 99 others); Mon, 17 May 2021 10:48:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:34234 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241103AbhEQOjh (ORCPT ); Mon, 17 May 2021 10:39:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4839961940; Mon, 17 May 2021 14:18:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621261117; bh=w0+6Qfrb1eI4hDll0vQaVzxrvkB9iFCcVUGwXflR2Dg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qKa8ZbY6T5ykREf4eQT8IrbhD8cI5zU+hsiu0GmAeiwZbOXBylIw1jKT2N68TyNm1 tiLZdlGryTddNYmRp40fHutrov4WC6aI+qYLFrxvcmxSSjI4gtQvPSDGprUouTA6r1 j/JAfDjXPCLxWx4yA/v5eO83SZSYFuM/ZIVbwibY= 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.12 307/363] blk-mq: Swap two calls in blk_mq_exit_queue() Date: Mon, 17 May 2021 16:02:53 +0200 Message-Id: <20210517140312.980190855@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@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 c0b740be62ad..0e120547ccb7 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -3270,10 +3270,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