Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp395760pxj; Thu, 20 May 2021 11:49:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDJ1Go/8wLNWR4CSrUDIcd0Z4v50AWMk1VyqKwd+DlYYZSf3FKMCJ88edNvQ2C3goftDtX X-Received: by 2002:a92:dd04:: with SMTP id n4mr7252644ilm.165.1621536586293; Thu, 20 May 2021 11:49:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621536586; cv=none; d=google.com; s=arc-20160816; b=NnV5yw8yMiyOf2+XMUp1kXT6FDR/IvFXWfQQR6d6Ou9FBbozbd1ao/ilKwkOhW7FTt jdJgfZAhFEIQZUG3DZ58k/DkwZCzxaF1O8tsSGt/B6UEiu+QI+fQ7oc6Hrl5qhGIvz4e m6vTsN/ZwFegqw8Xr6UzJqVm9yqVS3Rcc8hi/syKval/YpBTDBCHk0iA0K7TzwTYQpwq DX/1+AX0UCq6b9grv38Os+uL6RQ146ITug76fh9LMYCB7KWJTnt/JwxTgjc02P1OM2Vj MPsCx7IMXspvIe1bn9+VBwp6f0Q14hlDGhYvk+/5R/J7l8ueSfpE/3bZXcuaaHlwqJXt MonA== 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=fDiy0kr44lNhNkelQOHzCxbsMlZN/iarVQV/yv6lR6Q=; b=jUy99RcikP5HF97APuQS6yn0iXepBsmlI5CStpPMb47ZtJg3KGbGEm5uD+CvQyBorb j6kMhGBZo8wIq8MEfuWSgmvvIZhc4mpS1/OrSvSyk+m4L5E0CQK9unPufaG+kE5re2Xv F1ilM+hBnuifWV+odgCzcP/eti8CccX2RsJF9LMulLUytr8sCDLe02wdtvG+GBTLHLjF K9BA5i5n+/d0LUaloEOOtjhzIsFpoYZMMPoYZlIngyTXN9fXhnacQlBWESbv8PSXNOKC r3AnKJ1PD+elSB69q/2fu9022brA9o4NHjdhxkJSPmdKbhHRKnRxLGLDdaihCfmRjFOw UAog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FhdxCiIt; 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 a2si3408663ilp.43.2021.05.20.11.49.32; Thu, 20 May 2021 11:49:46 -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=FhdxCiIt; 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 S236466AbhETKYJ (ORCPT + 99 others); Thu, 20 May 2021 06:24:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:47766 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235914AbhETKM5 (ORCPT ); Thu, 20 May 2021 06:12:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DA58C6196A; Thu, 20 May 2021 09:44:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503847; bh=H1R+rLLmIe7smj8gAMNssW7E/wdXH7IoIX0djuumc5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FhdxCiItXX0JiWMoeHr7wrytw4YvIZbVSFBsjsO5Nlz/4eRawcDxxXkYzhkgVooDK 4eEFSthpLgFceTmFdfH3X9D85fu1ROTlNuoBwTwW6R4jbhCgIM9O2R8mxt+iKtn6Bl MuIfRZ7SbjrqzSIsZA/+0KT+UedLebE65cbKMaQY= 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.19 372/425] blk-mq: Swap two calls in blk_mq_exit_queue() Date: Thu, 20 May 2021 11:22:21 +0200 Message-Id: <20210520092143.624731783@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@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(-) --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2673,10 +2673,12 @@ EXPORT_SYMBOL(blk_mq_init_allocated_queu /* 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); } /* Basically redo blk_mq_init_queue with queue frozen */