From patchwork Thu May 25 18:43:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9748927 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 8B8AB60209 for ; Thu, 25 May 2017 18:43:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80ED0269DA for ; Thu, 25 May 2017 18:43:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 759722836D; Thu, 25 May 2017 18:43:58 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI 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 7372D2679B for ; Thu, 25 May 2017 18:43:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967211AbdEYSn4 (ORCPT ); Thu, 25 May 2017 14:43:56 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:52099 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1036474AbdEYSnk (ORCPT ); Thu, 25 May 2017 14:43:40 -0400 X-IronPort-AV: E=Sophos;i="5.38,393,1491235200"; d="scan'208";a="21580261" Received: from mail-sn1nam01lp0111.outbound.protection.outlook.com (HELO NAM01-SN1-obe.outbound.protection.outlook.com) ([207.46.163.111]) by ob1.hgst.iphmx.com with ESMTP; 26 May 2017 02:43:39 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=SzAZ9Rqn12ML7+tDgfkSERyrCHLDkNnunLGzE+hciiM=; b=Fyu5WKDjZIYsvW8xsPM2pqDkFUAWy0mloz513eR0PCcAkwwUZnWaf+uG4gVm43R3/SepkuIORfZZzNCF5pXUqyYRTGtgD+V68X6w8eU8jIYbqdnMykmlTOx1QeEImsnRfyBG4jqWImO1Is8WFBdWR9r+MfbeLEnECdD55Ls3CG0= Received: from MWHPR04CA0030.namprd04.prod.outlook.com (10.172.163.16) by BN6PR04MB0357.namprd04.prod.outlook.com (10.173.198.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1101.14; Thu, 25 May 2017 18:43:36 +0000 Received: from BN3NAM04FT036.eop-NAM04.prod.protection.outlook.com (2a01:111:f400:7e4e::204) by MWHPR04CA0030.outlook.office365.com (2603:10b6:300:ee::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1124.9 via Frontend Transport; Thu, 25 May 2017 18:43:36 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.225) smtp.mailfrom=sandisk.com; lst.de; dkim=none (message not signed) header.d=none;lst.de; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.225 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.225; helo=milsmgep14.sandisk.com; Received: from milsmgep14.sandisk.com (63.163.107.225) by BN3NAM04FT036.mail.protection.outlook.com (10.152.93.184) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1101.12 via Frontend Transport; Thu, 25 May 2017 18:43:35 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com (Unknown_Domain [10.201.67.162]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id FE.2D.19026.5D527295; Thu, 25 May 2017 11:43:33 -0700 (PDT) Received: from milsmgip11.sandisk.com (10.177.9.6) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.319.2; Thu, 25 May 2017 11:43:28 -0700 X-AuditID: 0ac94371-41ba798000004a52-a1-592725d532df Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id DE.E8.11415.0D527295; Thu, 25 May 2017 11:43:28 -0700 (PDT) From: Bart Van Assche To: Jens Axboe CC: , Christoph Hellwig , "Bart Van Assche" , Hannes Reinecke , "Omar Sandoval" , Ming Lei Subject: [PATCH 15/19] block: Check locking assumptions at runtime Date: Thu, 25 May 2017 11:43:23 -0700 Message-ID: <20170525184327.23570-16-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170525184327.23570-1-bart.vanassche@sandisk.com> References: <20170525184327.23570-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBLMWRmVeSWpSXmKPExsXCddJ5ke5VVfVIg7afehar7/azWSx4s5fN YuXqo0wWe29pWxya3MxkcfjeVRYHNo+Jze/YPS6fLfXYfbOBzeP9vqtsHuu3XGXx+LxJLoAt issmJTUnsyy1SN8ugStjxut9LAW/Uiu2d9xnbGBsDepi5OSQEDCRWNN+nAnEFhJYyiTx70VB FyMXkL2NUeLA0XmsMEXfpj5igkhsZpTY/vcGO0iCTcBI4tv7mSwgtoiAgkTP75VsIEXMAlcY JdZe/s4GkhAWcJLYv2cnM4jNIqAq0Tr7MCOIzSvgILHt1j4WiA3yEme3QNRwAsW/TL0I1MsB tM1e4sQNR5CZEgKLWCVWvn/PDtErKHFy5hOwXmYBCYmDL14wQ7ygLnFyyXymCYxCs5CUzUJS toCRaRWjWG5mTnFuemqBoYlecWJeSmZxtl5yfu4mRkj4F+5gfH3b+xCjAAejEg8vx0O1SCHW xLLiytxDjBIczEoivMqK6pFCvCmJlVWpRfnxRaU5qcWHGKU5WJTEebNkp0YICaQnlqRmp6YW pBbBZJk4OKUaGFVYzZ9HxMs+eHDk77THgV9W3WkLMVRfu/eRVu5RwaCzvHH1hYZupl7bHGrY Ioqv7xHqKeJft2xt4K1n6UEzLnC5OO8PnSJ9OSg62+yuCv/i+p2v/v7wjxZeZ75+/aka21uR V5bOzXf91FNbXcW9M/PUe4X1d642rTlfydTwp/3H3n2L/n98xqLEUpyRaKjFXFScCADSphvK ewIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOJMWRmVeSWpSXmKPExsXCtZEjRfeCqnqkwZJlrBar7/azWRz82cZo seDNXjaLlauPMlnsvaVtcWhyM5PF4XtXWRzYPSY2v2P3uHy21GP3zQY2j/f7rrJ5TFtznslj /ZarLB6fN8kFsEdx2aSk5mSWpRbp2yVwZcx4vY+l4FdqxfaO+4wNjK1BXYycHBICJhLfpj5i 6mLk4hAS2MgosWnaI0aQBJuAkcS39zNZQGwRAQWJnt8r2UCKmAVuMErcmTKVDSQhLOAksX/P TmYQm0VAVaJ19mGgZg4OXgEHiWt3WCAWyEuc3QJRwgkU/jL1IhtIiZCAvcSJG44TGLkXMDKs YhTLzcwpzk3PLDA01CtOzEvJLM7WS87P3cQIDhrOyB2MTyeaH2Jk4uCUamC8F7OvM/arRab2 +nNqUvk1X576/8ni/6J6xK0qdYYgY9xSxVwtt6UGexr26k+bu/m7VHmEuc013qsJd66Xfw9W 9V61/soj44/aq4+ERVzTPiy2R6XydHJdkv2EqdPuXfcqWbNtxw7t19dW8RkV/aiV6GKYwLc0 8vSvBIubl6+bxb31elE17/4NJZbijERDLeai4kQABJ+D8MoBAAA= MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.225; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(39860400002)(39450400003)(39410400002)(39400400002)(39850400002)(39840400002)(2980300002)(438002)(189002)(199003)(50944005)(9170700003)(305945005)(4326008)(106466001)(72206003)(47776003)(36756003)(6916009)(5003940100001)(356003)(6666003)(2950100002)(33646002)(8936002)(86362001)(50226002)(81166006)(8676002)(38730400002)(1076002)(5660300001)(189998001)(53936002)(76176999)(50986999)(77096006)(54906002)(478600001)(2906002)(50466002)(48376002)(110136004); DIR:OUT; SFP:1102; SCL:1; SRVR:BN6PR04MB0357; H:milsmgep14.sandisk.com; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN3NAM04FT036; 1:p5IHZt6jzhzaGYOHaQZRSXF8++se7ANemgWTGtZ7TMrmwNnBzeoTLTyOzVa1Y0JT1TcqRR8iivx4vqk+rECy/g6w90jju+c9oZUOb/PSfNC5T5UfV+v9j+jXusJcJ5Ei0DV+dnIXqXHkX01jdUm/QrPl3Jfh7PA9g+837VafCELDXsAwkWI5im54tCcwcCtv1Maom5dsCa5Rfmddeblv9k4P3RGN1ckrbMwZYakuBNn5spVizXyx46A1hsmZpbx8RAFywGg647ZgziWg8b8CcYQQrPvKwxUdyFxvPeeTQF/FIr4jaql9E0Wcq1IBYgfXKZC0hriLHmX2rXGfLUMfQwvkBIAC3sncO8ZprxNGBNwP4JxZVpZjtpg+Y0GPO3/iEM9RWcpvCYXy0yrRAg8mBPCaWiMufY0oq6j2oc9OR6vCoyx6h2Im3lHYotruUBZvNuoSNVKgukjiCpAZRC77NstCjBR8wVWToz4YfB5U4b0A2OttY0gobDE/+9e2D/SR+m4xtSKwTTGLxXVJpvnck8THq6shxNcGJ3xTgWNMOnY= X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN6PR04MB0357: X-MS-Office365-Filtering-Correlation-Id: dd14522b-c90d-4c6a-3f2d-08d4a39df396 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201703031133081); SRVR:BN6PR04MB0357; X-Microsoft-Exchange-Diagnostics: 1; BN6PR04MB0357; 3:YO4nZYEeMRFDkFNMI4DHliDsOeCLZ9S2LHtJ2TurIccckreUCzq6Eq4FcG+YYlG9ENWW0IK31I089VFIASy5pHfN1KoqrIAradTxNiI3jd6wChmfEm8iqYZgon3SDoR8LGgw5DGvQkfI/ZHRTGh/dv4mHRC0kvym/eIlHotZ3xaqjdIsRrBws0ND49pQsaaqLY1UB+AkgKSdvapJyRul+AwoNwj9HU/2epHm8D9rgzag4GZlzCjqVOWCre5oRFz1mNZfmSF5Wv59AxFWPOeQKkNGFKc+8bkdPGpF0ee2INKmam6bP8bnECo0edReBshW7rRs7XiKmw8QU41RX7eGZjkkMGpyta2t3hKH1FlhUib+l+RpHlwAANNaTl0USnBbvk0kbC+sdcTxPhF/Gw23pB4TTQqG9Jie1fQugPRHDrrk1Ku0SvANMcogPeZ4hFrP5TkcbACNVseibqOIswQC0Cs6i16FYOmAHStku2d6YpO/d8+dnkdbvZ4TOHxXfUZJ X-Microsoft-Exchange-Diagnostics: 1; BN6PR04MB0357; 25:xyhG9JJycAtosPaLtn4OjkNvSr8XL+JWJ8IFC2qLbut1LWeJzmuGA6DObYy0dT6dmhhihkiJrD12+8cFOrKSrNmEl6S5c8AeUqkWXegxU1YVu6X4U2gj9B4/QNdPTNODtkWEyEWZyN9VCIe6HQNRf7rcqvTUoHYnytVucF6BuQDCOBnwLXwCJ7nZoa1VA0FBr1oWJpKgwZ1dGw+1SBVtZDndTwU1I8cRa/IHn3fDh24piG4oiCHhWCibKzY9hfHnBpOjYJTgJqqY8svhVM4CDfUFHD1qMfpZNO9EfbX5PptTxG5ZJvisCsoEmT5H5KSWifKDzcuBoMwOwoAYEMPCAPQQPTHZZ9vmfV8r+eq2pGvQcS6Xc2YWH3vHVjUK/H0/PL7/onwV508goz1nuRX9B5J8nY8v6kk5CSTxGOuOtxkgR757pgOkkGVojdTkXiOuYMADYqx9VOlPR5FbbigYFFm9suNMxzVqjq6jQo9fTMw=; 31:SeehLXM3bQyMXDtSuq9hyfiX+5VJyOyWLiHWWWesM+0G28AoKsuF1wKRG0svHCb4jaRosihRbi27gDQNnxpoLJfnlRAs405XqMMH94A3dUBUSlFJA1aVVNjRlM2zMjuLZbrCaNsjjlEUZpBN+4xwEzqh5bVUiM9/YBsYF7e7ILAbbQO6K6lcVuQcHrHzTqMuMAA6XqfjwES5PBWk3eexz1s0Zb6z+UDGT9hbifWTAtTX18TvQ57+0cFQo+gpAJqBU8dKZStc/4k3ijQMQVv3vg== WDCIPOUTBOUND: EOP-TRUE X-Microsoft-Exchange-Diagnostics: 1; BN6PR04MB0357; 20:HM2MTz/+QDzPxMen4xFyL2HGa5o5mMcsOO4yiQS+Lm03gkeMiCAapsyuI6v3p580HIYJQFP+QUjR6wl1AZ4Riu1nnr2OE1qpl95x3IYzFnY/HQe6DyrPohjfkqmIV9u/Fd2SpeGMxUkCN+FpTSNZUTAV2DnVJhOecd+2RXIoCmSUfr6fKDj45f+626iIrHskEz8hygR3RC/mAHFpzoSfz9E03HVLS2WlkEg8b30JkPyKcBrzmg/R0NvfhN1Uo/E6fjjGUeCzYUzC4izfJ2DTg8qQ7aAI0fyr50bJnB4sHl9onEQ8YwsoycyI4DNa1jvm+qfr4SP/35bHS6rdUyyjt2HS/7MMRU2XFkwFv8+LSG8DC0ghqLCbCsadxfAaqsa2mARoOpLiYms/Gv/DNmyPtkt487v4+jkqkWlYzY/Yze1JouMxcGNyQELnYgh0PnG9rgnhlYE/b4Jhuvp/QpZVHVLpoQHtzNaBkd6/gnNVfKjIRFEkTu/a3P49940vzZXj X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700054)(100105000095)(100000701054)(100105300095)(100000702054)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(13016025)(13018025)(3002001)(10201501046)(93006095)(93004095)(100000703054)(100105400095)(6055026)(6041248)(20161123555025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123564025)(20161123558100)(6072148)(100000704054)(100105200095)(100000705054)(100105500095); SRVR:BN6PR04MB0357; BCL:0; PCL:0; RULEID:(100000800054)(100110000095)(100000801054)(100110300095)(100000802054)(100110100095)(100000803054)(100110400095)(100000804054)(100110200095)(100000805047)(100110500095); SRVR:BN6PR04MB0357; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR04MB0357; 4:P0SFb+6edHTqUbyoD/YGWFmZsx6rMtqRbqgYts4Z0F?= =?us-ascii?Q?DlQ6k3SxduEO/6Xy48x54HBZi6pi7+kM/sYVxyAoYWB7X5mQbO+LCpZ5PAhR?= =?us-ascii?Q?p22UMEeDjTkPAvZ1lrHVLkxXYjdZZSfeiPpum2ytBT2Dnk4vNsl0SKY9cFec?= =?us-ascii?Q?gr/Z/K8fhnCTIFJontOlLWu2yvZ/FEQxr1kwYaAAXYVh8rFPdU6WV0DmiujH?= =?us-ascii?Q?uMk/GRLUTuW4ShlnYQhDwmOpTFM+FvzhXigpDCvEf8TvQqyc6jxklNGCjmzn?= =?us-ascii?Q?jjN0n5P2x3OUhX57sYELqKVsd2EDHlTHYytyefBOYuKLNTuBm4lFJP+KpOfA?= =?us-ascii?Q?ELivgo/LRQBHZ/JnmE6E8gbVBRqvlgCTVcrmxL2+3+PXy97J9Zujerauu4Lv?= =?us-ascii?Q?owyOGkwusNYm9ndnjRtJH6ita8jDcNkLgsFiMacflbXrPnpH5+Z02S5nMOUf?= =?us-ascii?Q?hucxEVP4iefSfI9mSLZPHnA2LOXdI6K8MVsr73PRm8N+zLz58lQnIuiPZU1h?= =?us-ascii?Q?pbFstoxvKKTLUftzejqrg3kmP8QEknXVeO33IHbMl/8PFK+Ek3UjElNfCuN3?= =?us-ascii?Q?DYXJLD4yNWb3CBd8vYvnYMxmbuE6P1Is48W02RWWA5kOwZ+3KraFSrrqCEhI?= =?us-ascii?Q?YniXuH8h1O7m7E5fIJCU8zTnWr5/62lXUAvJgGraHc6EqIH6tvjS3GPnUBRN?= =?us-ascii?Q?yRtbJiaS8R/LfTL+cDwENUH7yPo+oNNrcW66ePnIzrEYTGpqHQ8kwbzmaRHx?= =?us-ascii?Q?/m4hOBVZKzK8B+YL2Ehh+MBueHanEpdZKAfs2zj6oIzaE8vJGCRA5VKRlQRu?= =?us-ascii?Q?rijGAg52nTkH3U55LBn2qoak8fsiC+6mC+jqEQK9lyOIWWXkgn6uS2OWAo7C?= =?us-ascii?Q?P52Y9asaYsMBe7Zby0dGNYHdrcutZIajmcyIeEdeJZSRKDKxlxwMBkFz7iv3?= =?us-ascii?Q?ICnKB+rSmtn7bayjLLVNrdLazyCazeURaaqUBlGtfDsbNXfkpY33Baynvrm1?= =?us-ascii?Q?lIzmbU0fagV4EUIF/S4ick6MBDZrrpauksBuRGhtFieNVhHwgKbnKqKilNks?= =?us-ascii?Q?oUbOGtxqUEKY8GLQ0O5QPB3tdGZuHej/NC8aViAI/cBVYnXpNGeEaDG2EA3r?= =?us-ascii?Q?DImwZj0zAwGgX95Wx4RbFV+RUrgX5mxEwPWceLlBLbHjwA5Lj8X91ZTHrEDv?= =?us-ascii?Q?lw/7fu6D6zFPqTIMImQAmOeVIw4sTgZupMxkPvfCbJDVzit7AbqKQmDUVduL?= =?us-ascii?Q?Z1YuqHqSpkrUXMzbY5qpoE29Lmk+g/DI04xPDquhVg/YVD0KKsvE9j/QusqQ?= =?us-ascii?Q?=3D=3D?= X-Forefront-PRVS: 0318501FAE X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR04MB0357; 23:KdqaXMMCGvxbRytW9RvXRenbEGGMbSLFFC/oTO5of?= =?us-ascii?Q?EulQt6q/oS0CWkbRABfed83BNyrQE6l4Yo34bRkoiLaGDzf1iyLlO6z+U6Yr?= =?us-ascii?Q?tTzdq7JMZntCz+HQDWNIiDy5Pc4mG4ldLQrnA9l84bBGkCK+Cu5hdkk4G/4K?= =?us-ascii?Q?kBuJMx316i5ltEr7l8vluyNuQvZCKajleezzMdnhzwytAIsJnK8kfsGyv+S2?= =?us-ascii?Q?7X2p0DDRVsrI4c8diIH/HSptHld8MX+Q+5SMbK58xaupAacfLz3FAkpLm0if?= =?us-ascii?Q?A9m4fQcDPehRaLoSIaYCH+vSHDBVuFDrEVyHZtFS/0y1wMznOfD+jbV5InVA?= =?us-ascii?Q?cmq25kTwYxfgYusJJnox10Z1jOey83nuVa9lKaG2meIKVnLdGK/crU+myZrQ?= =?us-ascii?Q?DzEC8r1k9etsD2c2AocmFyWAXX3wewuvswt82l1UFrJruqI2NXh9yJONSKNt?= =?us-ascii?Q?4tQkbsqKFY18ScmIA8LPySYPkuR1FRO76RxefXNVMFyddoWQYy4+yf+FjHOC?= =?us-ascii?Q?0tNvz91J7BQoUrCgtbDHvIGMkXZSl71CML9M4vhUozIV3o9mr/KbhMam67Us?= =?us-ascii?Q?Y5ewf7F2loPvvyyud8cSUm+beu/FQWirLlENKUm6jfOxrMQyOBab5GlwuTp+?= =?us-ascii?Q?8KWeHJMeqxx6ixbnpuzMqWnB6d5EhtMTA1PbE4d4ZXgzuwHboMs8Xv/eJvIu?= =?us-ascii?Q?b7ZBfjNd4JmUioPm3sWnuanGi1xyGGJG5xGbCoMC6HFSvMgLy6OeNYRdJWMq?= =?us-ascii?Q?4YjeVfWL+DEqNt9oXbQbrOvAczEFL6AyMn0EzYDFimuDkgpJ3YjzlYRt/TWr?= =?us-ascii?Q?LcPhv+Yeq2q/+hs2ZemCjqCDDgbWuxZN0nN6A8eyHfyTV72XNYVwuue1u0hm?= =?us-ascii?Q?ctBo1oB/EyKdUwS1NlT4F80G4G+iZ+S5TKwh5pD7BbXwDJrjdP5d7PVCJodV?= =?us-ascii?Q?loGgmvNCBxaJZFXyiR5I741Nhf6KLn87OFtiqC0nd0gfLq5QD1AjxzsOt+LQ?= =?us-ascii?Q?2SSq6prHgRdQ++F+IRy1vHR7FNwLqODr5XbymEgqnZSdap99/v4fCDwkErVz?= =?us-ascii?Q?wa322cw6mhXjejEVH0TDBc+5jmKHCxlsuM1Jfxr9hU4hkK9+B39PQ4+zBjge?= =?us-ascii?Q?zGvTtSPrmY=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN6PR04MB0357; 6:OLz/Xanf9xMJkuLL7d7YOnvYeAjvDvpyg3fJgXnaR+SmVHLOla4l/K16jjV0AIt/VLRHvV4VvWU+KsQIU1acvV2PKQXHZtwJ/triDe+QYbSHw4QrJTcaJBRzJdT8asjYQJdRPIle+yW5Pj4/CsNoljuVMGRuKWUccDkNvWnXC19pgupA7HHEwNZqIVQ2ttxZG9Ktd419CmOr2w8OGM7223Olguw7A9eUhj68gETs0E2uIfkE48o+pAm8Pui+VB6HwRjE/IhwIyJFQmTXLt5lzNBOoyJQpIgI169PiyYt9yIxS8EYkTvuTRb6FHVYcmwciBXYEpFheGrM4jQhtmBonYkIA+p2Kf8rJYH/0DBkEDyFV2GmvVQGfbX408GavOVqLDiqsZgFpkzC1r2WDZKP9+hjE0+rZIgXke/RfWROTcDI6M25YcqCucv7LCRrfzQRE8Hn+cU5c0xA5gVYanuwYC9e3/nMRSP12fVmoOHKMJGi2hRr314UFciHXhLnSAW8d1qEa+csW9qqdHGTKNr4hs3YNVTO37qzbXMjQ2JUjvc= X-Microsoft-Exchange-Diagnostics: 1; BN6PR04MB0357; 5:Z0Dt+npS2RbSsxLHy95kcGxK53rfJGfOXbzcl9fiaitet1S+nKERv/e1zwdoPbimqTj97VSf7qMhawW3x56E41qbnCfB0e4hGmN9bDurAMicIfwr3p9yP83IReyAg3hyN5i0IKjCYuDeRQZyOmedGr54GPkaHBusXO5gq50nHrar6NazqiZZa0bZmQeBQP5xml4hRSs085UJlyVk24TdYMrp3l+byKMUWEHUytx5FatjS2SMVdbDTUNOE//V7EJgrPlcGTiI/kUfzpert9ZguNYS/niwc6f7iBJf2OOr2kdJgX6UTOdeTch1dyXciZkhgf+nbSXKIe1KtWyz7ieK3t+eRdSMnOeDtcrIyn4VFQHXP26WwAIx3sluFsMOiWqk37581dzgTR/YGdv0J1pLrkWgGliwCrnGpH7zw77hsUEHHQSZ05Msgf81b4WlY/HvSGl3ko59SU++OziN54rwDO5FTGtA9dgbdCsoRm4hUEeyS8CdMgvfWcyettD/I7yO; 24:oWAyk+nuKqBIyNz9EIGXYheNGsFCY7zCJrV0yQhz+C+9Fp9CvImKU/JPgaXeQh8dTvBu69w0IcuOoAXLHs3r9DpyskI9QHEo3nUfuWQx3Fw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR04MB0357; 7:3b/kCEpD8wF/S3pTqUYoxr2rq19ns4qE/I/mXxeVVtNscaEYKo5OII8ODB9f56q+Y+WW49WiMY+Kk+H3B3oPUd/30QqCxPtsVf/StqikD/zJbIZHhGjlOmfaxeo7KMjGw8957HpRRz+xT0qEnjst8SvXL9lq+Q2D0U/pA0e9nMaf0VJVjjvKV7UjYFalvR+57UKJ2FwVNKrh8Jb3ttbRiMvUhsiDK2D5vInooCHBlb/kaPjCxxFS8ldAxNmPUlcvyBW8ZlOLEXoXMoskFXf39htuoRTkwMJMhiIEWVm1KOWLvPCsc4oZfXfiP82rLf7jzm2FZFLpfHIc2aTn9kD+zw==; 20:TadRYjLSWJzgwsFDvjPDz/K4Whw7xH/ufietUE5frhXEXYatXILKhRXJXgXJ/5+Yb0hKbQMmdK3WbtQb838JijeerEdK9PA2pJCkyNfwik2VhEKLJ8sAmoyDTnbym9zSVneXexmfTiBJ6fopf5CK4BrExN9BPK+NjIoj9eKpCu8= X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2017 18:43:35.1579 (UTC) X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=b61c8803-16f3-4c35-9b17-6f65f441df86; Ip=[63.163.107.225]; Helo=[milsmgep14.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR04MB0357 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 Instead of documenting the locking assumptions of most block layer functions as a comment, use lockdep_assert_held() to verify locking assumptions at runtime. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Omar Sandoval Cc: Ming Lei --- block/blk-core.c | 71 +++++++++++++++++++++++++++++++++++------------------ block/blk-flush.c | 8 +++--- block/blk-merge.c | 2 ++ block/blk-tag.c | 15 +++++------ block/blk-timeout.c | 4 ++- 5 files changed, 63 insertions(+), 37 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index fa453ed95973..418236b68fb6 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -180,10 +180,12 @@ static void blk_delay_work(struct work_struct *work) * Description: * Sometimes queueing needs to be postponed for a little while, to allow * resources to come back. This function will make sure that queueing is - * restarted around the specified time. Queue lock must be held. + * restarted around the specified time. */ void blk_delay_queue(struct request_queue *q, unsigned long msecs) { + lockdep_assert_held(q->queue_lock); + if (likely(!blk_queue_dead(q))) queue_delayed_work(kblockd_workqueue, &q->delay_work, msecs_to_jiffies(msecs)); @@ -201,6 +203,8 @@ EXPORT_SYMBOL(blk_delay_queue); **/ void blk_start_queue_async(struct request_queue *q) { + lockdep_assert_held(q->queue_lock); + queue_flag_clear(QUEUE_FLAG_STOPPED, q); blk_run_queue_async(q); } @@ -213,10 +217,11 @@ EXPORT_SYMBOL(blk_start_queue_async); * Description: * blk_start_queue() will clear the stop flag on the queue, and call * the request_fn for the queue if it was in a stopped state when - * entered. Also see blk_stop_queue(). Queue lock must be held. + * entered. Also see blk_stop_queue(). **/ void blk_start_queue(struct request_queue *q) { + lockdep_assert_held(q->queue_lock); WARN_ON(!irqs_disabled()); queue_flag_clear(QUEUE_FLAG_STOPPED, q); @@ -236,10 +241,12 @@ EXPORT_SYMBOL(blk_start_queue); * or if it simply chooses not to queue more I/O at one point, it can * call this function to prevent the request_fn from being called until * the driver has signalled it's ready to go again. This happens by calling - * blk_start_queue() to restart queue operations. Queue lock must be held. + * blk_start_queue() to restart queue operations. **/ void blk_stop_queue(struct request_queue *q) { + lockdep_assert_held(q->queue_lock); + cancel_delayed_work(&q->delay_work); queue_flag_set(QUEUE_FLAG_STOPPED, q); } @@ -292,6 +299,8 @@ EXPORT_SYMBOL(blk_sync_queue); */ inline void __blk_run_queue_uncond(struct request_queue *q) { + lockdep_assert_held(q->queue_lock); + if (unlikely(blk_queue_dead(q))) return; @@ -313,11 +322,12 @@ EXPORT_SYMBOL_GPL(__blk_run_queue_uncond); * @q: The queue to run * * Description: - * See @blk_run_queue. This variant must be called with the queue lock - * held and interrupts disabled. + * See @blk_run_queue. */ void __blk_run_queue(struct request_queue *q) { + lockdep_assert_held(q->queue_lock); + if (unlikely(blk_queue_stopped(q))) return; @@ -331,10 +341,17 @@ EXPORT_SYMBOL(__blk_run_queue); * * Description: * Tells kblockd to perform the equivalent of @blk_run_queue on behalf - * of us. The caller must hold the queue lock. + * of us. + * + * Note: + * Since it is not allowed to run q->delay_work after blk_cleanup_queue() + * has canceled q->delay_work, callers must hold the queue lock to avoid + * race conditions between blk_cleanup_queue() and blk_run_queue_async(). */ void blk_run_queue_async(struct request_queue *q) { + lockdep_assert_held(q->queue_lock); + if (likely(!blk_queue_stopped(q) && !blk_queue_dead(q))) mod_delayed_work(kblockd_workqueue, &q->delay_work, 0); } @@ -1080,6 +1097,8 @@ static struct request *__get_request(struct request_list *rl, unsigned int op, int may_queue; req_flags_t rq_flags = RQF_ALLOCED; + lockdep_assert_held(q->queue_lock); + if (unlikely(blk_queue_dying(q))) return ERR_PTR(-ENODEV); @@ -1253,6 +1272,8 @@ static struct request *get_request(struct request_queue *q, unsigned int op, struct request_list *rl; struct request *rq; + lockdep_assert_held(q->queue_lock); + rl = blk_get_rl(q, bio); /* transferred to @rq on success */ retry: rq = __get_request(rl, op, bio, gfp_mask); @@ -1331,6 +1352,8 @@ EXPORT_SYMBOL(blk_get_request); */ void blk_requeue_request(struct request_queue *q, struct request *rq) { + lockdep_assert_held(q->queue_lock); + blk_delete_timer(rq); blk_clear_rq_complete(rq); trace_block_rq_requeue(q, rq); @@ -1405,9 +1428,6 @@ static void blk_pm_put_request(struct request *rq) static inline void blk_pm_put_request(struct request *rq) {} #endif -/* - * queue lock must be held - */ void __blk_put_request(struct request_queue *q, struct request *req) { req_flags_t rq_flags = req->rq_flags; @@ -1420,6 +1440,8 @@ void __blk_put_request(struct request_queue *q, struct request *req) return; } + lockdep_assert_held(q->queue_lock); + blk_pm_put_request(req); elv_completed_request(q, req); @@ -2241,9 +2263,6 @@ EXPORT_SYMBOL_GPL(blk_insert_cloned_request); * * Return: * The number of bytes to fail. - * - * Context: - * queue_lock must be held. */ unsigned int blk_rq_err_bytes(const struct request *rq) { @@ -2383,15 +2402,14 @@ void blk_account_io_start(struct request *rq, bool new_io) * Return: * Pointer to the request at the top of @q if available. Null * otherwise. - * - * Context: - * queue_lock must be held. */ struct request *blk_peek_request(struct request_queue *q) { struct request *rq; int ret; + lockdep_assert_held(q->queue_lock); + while ((rq = __elv_next_request(q)) != NULL) { rq = blk_pm_peek_request(q, rq); @@ -2508,12 +2526,11 @@ void blk_dequeue_request(struct request *rq) * * Block internal functions which don't want to start timer should * call blk_dequeue_request(). - * - * Context: - * queue_lock must be held. */ void blk_start_request(struct request *req) { + lockdep_assert_held(req->q->queue_lock); + blk_dequeue_request(req); if (test_bit(QUEUE_FLAG_STATS, &req->q->queue_flags)) { @@ -2538,14 +2555,13 @@ EXPORT_SYMBOL(blk_start_request); * Return: * Pointer to the request at the top of @q if available. Null * otherwise. - * - * Context: - * queue_lock must be held. */ struct request *blk_fetch_request(struct request_queue *q) { struct request *rq; + lockdep_assert_held(q->queue_lock); + rq = blk_peek_request(q); if (rq) blk_start_request(rq); @@ -2721,13 +2737,12 @@ void blk_unprep_request(struct request *req) } EXPORT_SYMBOL_GPL(blk_unprep_request); -/* - * queue lock must be held - */ void blk_finish_request(struct request *req, int error) { struct request_queue *q = req->q; + lockdep_assert_held(req->q->queue_lock); + if (req->rq_flags & RQF_STATS) blk_stat_add(req); @@ -2809,6 +2824,8 @@ static bool blk_end_bidi_request(struct request *rq, int error, static bool __blk_end_bidi_request(struct request *rq, int error, unsigned int nr_bytes, unsigned int bidi_bytes) { + lockdep_assert_held(rq->q->queue_lock); + if (blk_update_bidi_request(rq, error, nr_bytes, bidi_bytes)) return true; @@ -2873,6 +2890,8 @@ EXPORT_SYMBOL(blk_end_request_all); **/ bool __blk_end_request(struct request *rq, int error, unsigned int nr_bytes) { + lockdep_assert_held(rq->q->queue_lock); + return __blk_end_bidi_request(rq, error, nr_bytes, 0); } EXPORT_SYMBOL(__blk_end_request); @@ -2890,6 +2909,8 @@ void __blk_end_request_all(struct request *rq, int error) bool pending; unsigned int bidi_bytes = 0; + lockdep_assert_held(rq->q->queue_lock); + if (unlikely(blk_bidi_rq(rq))) bidi_bytes = blk_rq_bytes(rq->next_rq); @@ -3154,6 +3175,8 @@ static void queue_unplugged(struct request_queue *q, unsigned int depth, bool from_schedule) __releases(q->queue_lock) { + lockdep_assert_held(q->queue_lock); + trace_block_unplug(q, depth, !from_schedule); if (from_schedule) diff --git a/block/blk-flush.c b/block/blk-flush.c index c4e0880b54bb..610c35bd9eeb 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c @@ -346,6 +346,8 @@ static void flush_data_end_io(struct request *rq, int error) struct request_queue *q = rq->q; struct blk_flush_queue *fq = blk_get_flush_queue(q, NULL); + lockdep_assert_held(q->queue_lock); + /* * Updating q->in_flight[] here for making this tag usable * early. Because in blk_queue_start_tag(), @@ -411,9 +413,6 @@ static void mq_flush_data_end_io(struct request *rq, int error) * or __blk_mq_run_hw_queue() to dispatch request. * @rq is being submitted. Analyze what needs to be done and put it on the * right queue. - * - * CONTEXT: - * spin_lock_irq(q->queue_lock) in !mq case */ void blk_insert_flush(struct request *rq) { @@ -422,6 +421,9 @@ void blk_insert_flush(struct request *rq) unsigned int policy = blk_flush_policy(fflags, rq); struct blk_flush_queue *fq = blk_get_flush_queue(q, rq->mq_ctx); + if (!q->mq_ops) + lockdep_assert_held(q->queue_lock); + /* * @policy now records what operations need to be done. Adjust * REQ_PREFLUSH and FUA for the driver. diff --git a/block/blk-merge.c b/block/blk-merge.c index 3990ae406341..61206eeeaaad 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -671,6 +671,8 @@ static void blk_account_io_merge(struct request *req) static struct request *attempt_merge(struct request_queue *q, struct request *req, struct request *next) { + lockdep_assert_held(q->queue_lock); + if (!rq_mergeable(req) || !rq_mergeable(next)) return NULL; diff --git a/block/blk-tag.c b/block/blk-tag.c index 07cc329fa4b0..2290f65b9d73 100644 --- a/block/blk-tag.c +++ b/block/blk-tag.c @@ -258,15 +258,14 @@ EXPORT_SYMBOL(blk_queue_resize_tags); * all transfers have been done for a request. It's important to call * this function before end_that_request_last(), as that will put the * request back on the free list thus corrupting the internal tag list. - * - * Notes: - * queue lock must be held. **/ void blk_queue_end_tag(struct request_queue *q, struct request *rq) { struct blk_queue_tag *bqt = q->queue_tags; unsigned tag = rq->tag; /* negative tags invalid */ + lockdep_assert_held(q->queue_lock); + BUG_ON(tag >= bqt->real_max_depth); list_del_init(&rq->queuelist); @@ -307,9 +306,6 @@ EXPORT_SYMBOL(blk_queue_end_tag); * calling this function. The request will also be removed from * the request queue, so it's the drivers responsibility to readd * it if it should need to be restarted for some reason. - * - * Notes: - * queue lock must be held. **/ int blk_queue_start_tag(struct request_queue *q, struct request *rq) { @@ -317,6 +313,8 @@ int blk_queue_start_tag(struct request_queue *q, struct request *rq) unsigned max_depth; int tag; + lockdep_assert_held(q->queue_lock); + if (unlikely((rq->rq_flags & RQF_QUEUED))) { printk(KERN_ERR "%s: request %p for device [%s] already tagged %d", @@ -389,14 +387,13 @@ EXPORT_SYMBOL(blk_queue_start_tag); * Hardware conditions may dictate a need to stop all pending requests. * In this case, we will safely clear the block side of the tag queue and * readd all requests to the request queue in the right order. - * - * Notes: - * queue lock must be held. **/ void blk_queue_invalidate_tags(struct request_queue *q) { struct list_head *tmp, *n; + lockdep_assert_held(q->queue_lock); + list_for_each_safe(tmp, n, &q->tag_busy_list) blk_requeue_request(q, list_entry_rq(tmp)); } diff --git a/block/blk-timeout.c b/block/blk-timeout.c index cbff183f3d9f..17ec83bb0900 100644 --- a/block/blk-timeout.c +++ b/block/blk-timeout.c @@ -189,13 +189,15 @@ unsigned long blk_rq_timeout(unsigned long timeout) * Notes: * Each request has its own timer, and as it is added to the queue, we * set up the timer. When the request completes, we cancel the timer. - * Queue lock must be held for the non-mq case, mq case doesn't care. */ void blk_add_timer(struct request *req) { struct request_queue *q = req->q; unsigned long expiry; + if (!q->mq_ops) + lockdep_assert_held(q->queue_lock); + /* blk-mq has its own handler, so we don't need ->rq_timed_out_fn */ if (!q->mq_ops && !q->rq_timed_out_fn) return;