Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp424358pxj; Thu, 20 May 2021 12:31:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDq2biYZ90SIm/yC9K5FafUMuJQn44zFm6Dac7i7jamTr1IaygBcbRzCLCBHNrC9OKHx08 X-Received: by 2002:a6b:690c:: with SMTP id e12mr7300029ioc.69.1621539093759; Thu, 20 May 2021 12:31:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621539093; cv=none; d=google.com; s=arc-20160816; b=KsPoo0fViCJUtYp2ZmyRPCEwGDTtZXwBssgG/qCSD0x+aOwCj7Z3iAYY73saWhHJuu 16zIN1Nf1SbD75mLYjkdI3sf46j15IBWC082qCwP9HepaCbeO8vdd/uYfqZEdbiTIFEs qH2K3Z7vfVfg4pzNDoIauJKAqSA+icqGnoQ4k65NthqaplryK8+Vh8H+5+ytHa1YAdeq K9/uappkXASn94mwbpywLt4TZoimI9bvhPOicvpiFEnIVWi4hfxn4yE93u8EnIy6DZ6p Eetw7+EnGNlzaZE6zQFPCM4xLQCYvJt/LEkVcp+fljoiB3/vm2YkGrd+mjeqAf/+x5Jp LWgA== 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=umU51YisTzgjDa7k0QcU41CLde+696CkFpZ0hQu+KbY=; b=m99QKc3IajRfXeM/2nEpSCgacRzgK7dUlIx7tmNDMaepr2nThrDpqfjBD/wijGQAr/ 4DvGnSg1ANSb5fJY52oivf9G9zdgiJl1+3SensmsZfzO9KJuQum2NrnMIgxy15z8Ip0x N3ZHq8Jc5T+Q7aHd0Ift1UeLreMc0dVhBPDuycFp4B1ON3MmszgY7JEwH3mNq+XHZ6w4 pjdW7xbINcOAF+KEbbGXznfkmzFYoIK6fjh6gvdzOnINf0t3oLQid64EvZRU3BOdZm3T twfvLnd5YDKlwdaojtwAFxAAc+eJLkpSB1LbVCUsss2PN7KotH2VCoWJ0E0wd9Y5BK6D s5yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=T4XWx9cy; 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 n20si3315040jat.115.2021.05.20.12.31.20; Thu, 20 May 2021 12:31:33 -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=T4XWx9cy; 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 S238699AbhETKzE (ORCPT + 99 others); Thu, 20 May 2021 06:55:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:39858 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238231AbhETKjn (ORCPT ); Thu, 20 May 2021 06:39:43 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 00CAC61C77; Thu, 20 May 2021 09:55:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504523; bh=7vx0vj6tEE+9WDAwQ6VJZdwh+sqangh/uiaOhn30SG0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T4XWx9cyn4ADdLtsuk5HXcSpBQE1jVeMgLud3jcQIr4bz9POO7Cg9HIq7LjVG2Fhb qIRYIxazoXipqWQN/dcD7dgx9LllAS7rDWqdsjwBncXIGcSXNGuZPqThJVMV+ENm3X DQDaVBEphQxlMtVSGaCBFbsOJ+3FAt3WJEGmf+l4= 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 4.14 285/323] blk-mq: Swap two calls in blk_mq_exit_queue() Date: Thu, 20 May 2021 11:22:57 +0200 Message-Id: <20210520092129.990282542@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@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 cf56bdad2e06..7b785855a6e4 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2489,10 +2489,12 @@ EXPORT_SYMBOL(blk_mq_init_allocated_queue); void blk_mq_free_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); } /* Basically redo blk_mq_init_queue with queue frozen */ -- 2.30.2