From patchwork Wed Jan 10 19:34:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10156029 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F080B60223 for ; Wed, 10 Jan 2018 19:34:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E3AB71FF22 for ; Wed, 10 Jan 2018 19:34:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D7E9C200E7; Wed, 10 Jan 2018 19:34:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46A7A1FF22 for ; Wed, 10 Jan 2018 19:34:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753587AbeAJTeb (ORCPT ); Wed, 10 Jan 2018 14:34:31 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:1072 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752790AbeAJTea (ORCPT ); Wed, 10 Jan 2018 14:34:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1515613108; x=1547149108; h=from:to:cc:subject:date:message-id; bh=kYOnK4rK7r7RJRTbFkBdY78CwkC2WabAES/j/v5EcIg=; b=IU7CxTeHHiP8WjyImbGCM50kRoFW4Vf8BFm3Ebva4jGRABzndYSa35GE pYsj6I0MgLjk/a5MnUtTnmVgg6iyXKivfpdMahAWkSDOJHBiLcksbO5Mf BD+K9e39yfH0a1GSAwtSpKvqL2YBWR3OWILEgWyrrVVJ7hcn6xabX8h2H erOl493npNRsrkZBiqRk/dBsQ+3dmpqdMZ8LsQoH0VzY5/gpgszntZF6A pS2vcIiYNb/MmGmRdB0WqaOtY77UEmA9u0GuAtabMirm6C+LazVB9zFKI PFy2r7AWXsd7W6/JC+nGacUhgQ2sEUJoc3OIWR1YwsHiaMqdFosUVTPv6 Q==; X-IronPort-AV: E=Sophos;i="5.46,341,1511798400"; d="scan'208";a="164734150" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 11 Jan 2018 03:38:28 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 10 Jan 2018 11:30:23 -0800 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.171.236]) by uls-op-cesaip02.wdc.com with ESMTP; 10 Jan 2018 11:34:28 -0800 From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Tejun Heo Subject: [PATCH] blk-mq: Add locking annotations to hctx_lock() and hctx_unlock() Date: Wed, 10 Jan 2018 11:34:27 -0800 Message-Id: <20180110193427.6601-1-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.15.1 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch avoids that sparse reports the following: block/blk-mq.c:637:33: warning: context imbalance in 'hctx_unlock' - unexpected unlock block/blk-mq.c:642:9: warning: context imbalance in 'hctx_lock' - wrong count at exit Signed-off-by: Bart Van Assche Cc: Tejun Heo --- block/blk-mq.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block/blk-mq.c b/block/blk-mq.c index 8139d88e78f6..1d705e25852e 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -630,6 +630,7 @@ static void __blk_mq_complete_request(struct request *rq) } static void hctx_unlock(struct blk_mq_hw_ctx *hctx, int srcu_idx) + __releases(hctx->srcu) { if (!(hctx->flags & BLK_MQ_F_BLOCKING)) rcu_read_unlock(); @@ -638,6 +639,7 @@ static void hctx_unlock(struct blk_mq_hw_ctx *hctx, int srcu_idx) } static void hctx_lock(struct blk_mq_hw_ctx *hctx, int *srcu_idx) + __acquires(hctx->srcu) { if (!(hctx->flags & BLK_MQ_F_BLOCKING)) { /* shut up gcc false positive */