From patchwork Thu Jun 8 17:33:51 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: 9776171 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 A2A2E601C3 for ; Thu, 8 Jun 2017 17:34:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89B7E2521E for ; Thu, 8 Jun 2017 17:34:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E37F27031; Thu, 8 Jun 2017 17:34:44 +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 774C12521E for ; Thu, 8 Jun 2017 17:34:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751558AbdFHRel (ORCPT ); Thu, 8 Jun 2017 13:34:41 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:62043 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751461AbdFHReg (ORCPT ); Thu, 8 Jun 2017 13:34:36 -0400 X-IronPort-AV: E=Sophos;i="5.39,315,1493654400"; d="scan'208";a="126519573" Received: from mail-sn1nam01lp0119.outbound.protection.outlook.com (HELO NAM01-SN1-obe.outbound.protection.outlook.com) ([207.46.163.119]) by ob1.hgst.iphmx.com with ESMTP; 09 Jun 2017 01:34:06 +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=mAOga7GdhAMld/hIdA6mZGm/qbivz6hq/iLnLf2/5JQ=; b=cRYYZLMeshNtH12A5Gkh/uhtd948XsDkYDvSamChM1njt2f4EbQvbaY+kVPFouWKR0lqNAJXfVgQ86C5UXl51rpJjDdDeEEnC1ta09sgAOe5vYqJPpAeJAyNdc2+qkTowff8spSUe7IYla2slObWKb26xaffCklGehCNBn4c6Ns= Received: from DM5PR04CA0066.namprd04.prod.outlook.com (10.172.183.156) by CY4PR04MB0409.namprd04.prod.outlook.com (10.173.188.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1157.12; Thu, 8 Jun 2017 17:34:04 +0000 Received: from BN3NAM04FT023.eop-NAM04.prod.protection.outlook.com (2a01:111:f400:7e4e::204) by DM5PR04CA0066.outlook.office365.com (2603:10b6:3:ef::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1157.12 via Frontend Transport; Thu, 8 Jun 2017 17:34:04 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) 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.21 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.21; helo=milsmgep15.sandisk.com; Received: from milsmgep15.sandisk.com (63.163.107.21) by BN3NAM04FT023.mail.protection.outlook.com (10.152.92.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1143.11 via Frontend Transport; Thu, 8 Jun 2017 17:34:03 +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 9F.59.51736.98A89395; Thu, 8 Jun 2017 10:34:01 -0700 (PDT) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.319.2; Thu, 8 Jun 2017 10:33:58 -0700 X-AuditID: 0ac94369-6dc8f9800000ca18-0c-59398a89319d Received: from exp-402881.sandisk.com.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 4C.E7.18148.68A89395; Thu, 8 Jun 2017 10:33:58 -0700 (PDT) From: Bart Van Assche To: Jens Axboe CC: , Christoph Hellwig , "Bart Van Assche" , Hannes Reinecke , "Omar Sandoval" , Ming Lei Subject: [PATCH v3 08/12] block: Check locking assumptions at runtime Date: Thu, 8 Jun 2017 10:33:51 -0700 Message-ID: <20170608173355.25898-9-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170608173355.25898-1-bart.vanassche@sandisk.com> References: <20170608173355.25898-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBLMWRmVeSWpSXmKPExsXCddJ5kW5nl2WkwdPXmhar7/azWSx4s5fN YuXqo0wWe29pWxya3MxkcfjeVRYHNo+Jze/YPS6fLfXYfbOBzeP9vqtsHuu3XGXx+LxJLoAt issmJTUnsyy1SN8ugStjyrPNTAXT0yp6lp5mbWCcF9TFyMkhIWAi8eTPcpYuRi4OIYGlTBKf r29lhHC2M0rMvnWQHabq94F3UFXLGSUeXP7CBpJgEzCS+PZ+JguILSKgINHzeyUbSBGzwBVG ibWXv4MVCQu4SnzbOo0ZxGYRUJGY8vgRaxcjBwevgL3E8RN2EAvkJc5u2QlWwingIHFt5xKw ViGgkr0NEGMkBBaxSsx5LQdi8woISpyc+QRsL7OAhMTBFy+YIerVJU4umc80gVFoFpKyWUjK FjAyrWIUy83MKc5NTy0wNNUrTsxLySzO1kvOz93ECAn/zB2Md594H2IU4GBU4uFNiLCMFGJN LCuuzD3EKMHBrCTCe9QAKMSbklhZlVqUH19UmpNafIhRmoNFSZz3nMzUCCGB9MSS1OzU1ILU IpgsEwenVAPjptLveyVPKZ/kZi66Yr9f2FxOLV7XreqZ4KPLfz8npez9/Zz96wWO7NOKjd8m P9DSvnPBxMn7uehJs9sTVyTvkzOf0eC7YVnC1p1d0kc7mS9vet/49O2nuu98rMlv+I5PNN0/ peDOyhn9X6TvJemYT0oWuWX0N8esvCfEX5lzz6lIrSOfTgXOVmIpzkg01GIuKk4EAGoowj17 AgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJJMWRmVeSWpSXmKPExsXCtZGTTbetyzLSYOYZC4vVd/vZLA7+bGO0 WPBmL5vFytVHmSz23tK2ODS5mcni8L2rLA7sHhOb37F7XD5b6rH7ZgObx/t9V9k8pq05z+Sx fstVFo/Pm+QC2KO4bFJSczLLUov07RK4MqY828xUMD2tomfpadYGxnlBXYycHBICJhK/D7xj 6WLk4hASWMoosf/aJ2aQBJuAkcS39zNZQGwRAQWJnt8r2UCKmAVuMErcmTKVDSQhLOAq8W3r NLAGFgFVic8/HjOC2LwC9hI7j59ggdggL3F2y06wGk4BB4lrO5eA9QoB1ext+M42gZF7ASPD Kkax3Myc4tz0zAJDI73ixLyUzOJsveT83E2MkMCJ2sF4faL5IUYmDk6pBkaL1Qqb8nf9TDxY ZzkjRWfS5SNx8eoT/XyVuu7vrfKRvn5iqukVcy5VEX792SuypzZeiy48pj+TPXFt9577exY5 nboisnGWT+TGxs1ipYodmlvXaTbVeNacMvpj/cIh9OzCK8aV+Tk1l74uehv2za/o88of+ctL nxRMe8bWsGjB7I+OGT+YVOcqsRRnJBpqMRcVJwIAHix9GcwBAAA= MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.21; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(39860400002)(39400400002)(39850400002)(39410400002)(39840400002)(39450400003)(2980300002)(438002)(50944005)(199003)(189002)(9170700003)(8936002)(53936002)(5660300001)(48376002)(478600001)(36756003)(81166006)(50226002)(8676002)(2906002)(110136004)(50986999)(54906002)(189998001)(76176999)(305945005)(1076002)(86362001)(4326008)(72206003)(6666003)(77096006)(356003)(2950100002)(47776003)(33646002)(38730400002)(6916009)(5003940100001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR04MB0409; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN3NAM04FT023; 1:e5Wjc1WbzzQJenAmm7ORYhURlIxNjaHE/R1+pk4lhj9xpDH43BkGd8cA3FDePTPeaB2XHKYxPHm1BFaSZ/hs+/enOl+NDnjPCQq9ZchrIx26mzmb22RYBmxAFcWMaP6OmMEXmTgHJmM4sDVrs9Q/JgQZWlmgIGow5oNsBONVpKu732WzCYkuI69nJpZFONn+1fAgxC68gTDlDyJ+psuVr88uF4hi4q/Dw/GLUblBzPtukGLwDzqVj8iopZvyKxuOV5PLyT9muUaHcVEK37qho+Xf9TfQ7xRXpUHbF4lhBPCfx7DZDX+H+kpYZi+I/mQqj4HuebX/bxcCyFAlX5teZGsTfujsmB3yj1POPZuvDygH3cdXwRyklCXOompdAvEciD1UKfAr0qLEHOVgeVKdcmOH1zd55J2us79cJqgnVexzovk+IHqngHuKgSt999hsTS763XyJp8cLehqAFE1j0uarXWuJnkdGnxxq5UgLQAnhRSFAjzAGsrT0dOzjW3hPfoGHF0q1w55oHFahKrN8mdLfrmnQKvLJ+ZjN8XWpX8X56WlvF6V9zg0wyJM5tOaK X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PR04MB0409: X-MS-Office365-Filtering-Correlation-Id: 18c55e4d-4847-447b-aa0c-08d4ae948ea2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201703031133081); SRVR:CY4PR04MB0409; X-Microsoft-Exchange-Diagnostics: 1; CY4PR04MB0409; 3:/BqP9HZ2xTVC0NwamiuXaIDWG+ZisEu6rrDR7bS5BWpl2DYQRxB99mb321KzHXZsRSrYvT4FtR6FoqLHNzdUBs3H7RmbK72KEtAxj33oHGgGoKlRN3XCqbKlyJtxVabmIt6KYukLODZxRpLxMF2XDU6RTMWpyMkrKi+IuY2kf9qbyTTmtkj6kB6IbGfDhjKAsPFs3WiY7Bn6zSjJxpV002IdO++uvwPGQuxzp2OaNcgpeDAngtU18X2HARWXFUmpWqpcR2aGh5Hq30WN2re77mk9ClIGTz1/lFivfAPORYzIfnac8xPyvutNOw2ISzycXR4fXuhYAxPcDCsE7yAXf12FJ5rakHBXHVrLaVcCmWskhwrOl/913Vjz+kWlHefRXeb1u2RLKv76oq+IGW/X6UmPcMbhYZHAy3fZZuLHS4BSa8U/5ecTgnTOqqW2JXmR7E7xpfm23TOEslzvIIL0JBvIK4XIdX2WO3jSMVHDJ2a7vn+V4m8ZL2bQVxy6KLSi X-Microsoft-Exchange-Diagnostics: 1; CY4PR04MB0409; 25:qLU+IYJp8HogqjPljT/zhn6a9JaIdiDlhP7NqfwX2UC07zi48Y07qspjVRTXubOt1V00G+RfPlGRp/JebhW7zovYdR05ne3huWgJwLfD4IXHTtsjKuoHyeQRmiRI+Bfhma03smKpX5q6hCncTNfdn6+2xt2JvL7ntmG9T4k/7OCQ/xUMJEJL7J893yE9DZlGveb5+i8/VQUJczqlDv04RWMNANCpfvugiwGLMaj9ZzUl97QEkju1zHP5v9CPW2j8DcfqgDjoEA2ln5lwmeqJ8vNG0CypPSPIkh+eIn8iYdh6tJ5PMYpfBbjEXVsm7v3XQJYPQ3ecgYX+IMF0yzVVbBB8jondFuC9uM6TIzLGsYAnrrFsKVa5pf4mSHrTMIjaM4hqD10r1uNvkPxANJvx+NdJl6eIemVDrE/NfllZkDQQOejz6Ab2yeQsCRCyDDQvEaotniVZv6elYM9ZyLLTVuEavbVo6eEUwcLA0BO2hvQ=; 31:s5V3N0DU7++0b4fbvpdZLICn0arbpRcKVvi6yD3HYOLYsg9PuOLXOUYL57z/404GckmMcezr/MhKB07nHh/mqIVcbSyAVlhvzDDweLABe9h8erR0pAvN6ECrTZulD+21CMyPctWNRSw3Rvz283XfZhEVdYuwXIzXoZunLV6umQXEsyz8Rx/53oizi3E9NBYK15O3gAKSTWSWOszrW4fWIUTBJS+avKYMwHiDO0PnAKvSjrGTPKzNJq8YTOrPBmXilX6B73DqnWsXsr0BWetcKg== WDCIPOUTBOUND: EOP-TRUE X-Microsoft-Exchange-Diagnostics: 1; CY4PR04MB0409; 20:5kBF+IauHfTTgq4dgaB1PTDJ60oVm9+tin39CMEXiCWwX+FbLMG6bMOAh/5+OS8Qu0jtA1tRZvOEjdGo2Nwlsg29+Cy9bi+bsjhfQlxJgSx1BuT+epFrkTMsbVTjirmo4hg+g9QRGtxMtuveIgssifXmDJQyMULu9+EvVQ2nsfvBmsr6detusri6YLa7pBuw+5CeJYvWrSX3WvKpt8E0bi/Axjy3yD1jH6dDW60UCICjSNuniTBmWCUGlG/baWhYREWNes0mr7BrBlKEehv2SgRYs06sJuWL/Ipk3k0kbIkBt7sEHquUs4lgqKEC/rVUY9tZKj++0ub7ii2Ki9aEUgB3BiHeRnIHJ8zzMrAf6VQUfoCLScYJKkZ5F3fwwau62Qkj47lGa3pHJW093HCfLtnIlPJQk0b1Vw6Oi5cdJSyJ22ClhLax2vHlpDr/1XdG/R4QOzT6CWvMXyqVEAXCS2udvHgi0LQjCEJBbUYkW2BbfOypzDGdTea/eHjTZk6L X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(13016025)(8121501046)(13018025)(100000703101)(100105400095)(3002001)(10201501046)(93006095)(93004095)(6055026)(6041248)(20161123564025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123562025)(20161123555025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR04MB0409; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR04MB0409; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR04MB0409; 4:W4GIE+UCuiKfj0L48G4v/9FiWV7Tt2ZzaxfAL7ZFSd?= =?us-ascii?Q?b507HaJxp/5vH73Uk6IIsDbNUyI65830+MO+gsaQoxsIZqi0R7zF6jPosr+M?= =?us-ascii?Q?cLY358LSDeNy8FG36HCP09vCbQgh/qYRRjosI4hyUJs4PBbbIt/NtyUnYxja?= =?us-ascii?Q?WhPskmKs7tPhOeodI7fEA5nmNxVzc3811c2DuuChHGAtgadmIADw3HoN3ZUP?= =?us-ascii?Q?DkFyeSHpNWLrzTMHhHF001DbSPo4i7I0xOER+HLfDE3XPS7fAPK7yFQ1tH9W?= =?us-ascii?Q?5KBluxvTtTcfHuJ0akH6Csv/086hJqhdH1cW5CiFI5SYQCbXHENmJA/VFNnE?= =?us-ascii?Q?lbPGwnon1DCZxGsiTwfPYgZsWepx3wITcwpdA7B/7t4KqbzQRsjNwsjBkphz?= =?us-ascii?Q?Etu5fj1Qgt2uir73efozkVaE4oTnnQOXNkeejtlbif7R09u5wkoL1V/CbE8h?= =?us-ascii?Q?ZU0SV4VPdJWzrfgAGX6CqDvcNfMFUMEOg/EqDa+qhz9YOaZSRdN3BU8XwlvG?= =?us-ascii?Q?pbNKn4km28qKCSwHI0dwCWJX5sRMkInpZssuOT5/ar8HG7hErYdhjdb0xMN/?= =?us-ascii?Q?mcGsYmzWupUwyaFVL4mXMAMoetiFjSmInbzRvpfGoOVQmr+VzOo3pCMIsHmr?= =?us-ascii?Q?75/3sEYoV9ZEdzYJBhOo36JnKT4RYWlMOuKUyWSoznJwRZFXW6ihFJrn3/iR?= =?us-ascii?Q?l6VfN/tlGEiatC+I+Y3TDO6lGHGTZwVju9TSPzsi6rM/F8cmM0bYbsLdxfOZ?= =?us-ascii?Q?IhamRtN+d/2LFADtHNq+Po8le73k8igmAD7VfcIvGTibUGcWuFkcLXZU7wce?= =?us-ascii?Q?rksZv9WbWDoG/w4heneMr6HedsEi38mL6xSfQsxUnYuMlYhsi3XaJm8c8GB3?= =?us-ascii?Q?UM6TrMctiAjP68Aj+1i5nYkTjIH+SklOmBElpIvo8XHabGwGUCaGFFNbNU41?= =?us-ascii?Q?s2Cpb9ZvKsDkJ0sHCGu78EQwiNoYywqIl6hYI47CBegAN0lwyYsPuIJrESO6?= =?us-ascii?Q?nONfH6enN9STTQeNpOa1uDVdBsoxmUtkvc5oP+N49s5qY9fWeypS6qERUy7h?= =?us-ascii?Q?eGbTZvAlmeFpec3pUq2CtxSVd4Ze5jbsE0Efe59vNEFUwEwjgIb/C4BCnBXq?= =?us-ascii?Q?2vJ4GoBhNe/36p7TrUanRgQQxbmrUJRbNZKEOF5CrtLuwQG1mtOuyfbJ2QJH?= =?us-ascii?Q?YILjlZxfFSBPYzaYdoVB5n9OEPvtiuykVbUB4QCqXkgitpTEYaQTewW74KHX?= =?us-ascii?Q?qf2YbkVJUHhKHGjZM5xWs9pUk5ONkZD4XmbzfuMy7AN10kKd1cWklmKi9emw?= =?us-ascii?Q?=3D=3D?= X-Forefront-PRVS: 0332AACBC3 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR04MB0409; 23:qoSfSAROdknCcOA6siOzeYM90FRKAVT7U4ob1CzD/?= =?us-ascii?Q?sDlMXODLtmvgbQERN5b8D9UPYg2vg6Uk7WYt3IdDSR7xbRxZ2TAANDwmqwM4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ltLC7aBSRY9GZIRa84zfuNCT3/Fg8nOyj+G2CR/V6poPIJ6okAzOdeMmVEB7kl2tyG+JQ57XnX11WkWKqeGoO0Pz6T7uZLhUXs9iil1qczhTD+pORds1pbnh8eNTMnJ/HMUC/zVnUttwGO8HOy+zQtEhSrCvMzMQdUL/yTgld21Y0LAZEKwdlVhLS4nySkbAjjh3bTE5k1obxAfuaETnpYx3KIjPp7WX4B9ePo9hm1; 24:7zRfwxYkUEUOuwlTNFwxiag935tNsDGtO5aj1ByfVq5IB7/HzKWvYqyqse+HZxvchS0ZYcpNMClaYV1rldC6lDhxEuXXuAMxmlZDk9CH4uw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR04MB0409; 7:tuYwmonypVRJg4Qa2ikJcvgPRltJo1EbNevjkoIJ0QCWGHM4ewJo/onr/Aukj1rOEFEinxYe6d8NgIrfnQJl1VychU25KMQVklSzk0gTjX01MEUwg4a7J1NxAZXjkOyBOM9lRUxy137TAioAPTQ40Cd2tWEtIDX+SnWTHSdXdEf0//neJwwDFoBBh3RFKG+caty4s+ijPwHg0ukMPBeCoRHl+MR7pwU34aij2Jdd5Rul95RA3lIy0u/IFM6V3gF4sfUckBwXn59WKXhEsMqxtjlU+WW7ouK5hUtbNlNNRHqqEPMqhKs870TcvoxkxIBhNjer2cHXxiRYS6iIzkF3tw==; 20:b1TXvf3R7Em19ClKRnnlBl1Kv2Uqv1G8dvQNSVvilU48N6bctSpXshq7arOgbEEAs5f0zMrCgh4dZREHFDnvxq1n76ZedlmA2TeT0sExKYC7E+Zusu9xnsdMfxeTxasUlH5uYL+OHAxszoZL1a+t5PkJIQe8nUVIgcHQDlyMrmo= X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2017 17:34:03.1094 (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.21]; Helo=[milsmgep15.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR04MB0409 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 Reviewed-by: 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 | 3 +++ block/blk-tag.c | 15 +++++------ block/blk-timeout.c | 4 ++- 5 files changed, 64 insertions(+), 37 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index 86fc08898fac..6bbdce8b8b6f 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -177,10 +177,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)); @@ -198,6 +200,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); } @@ -210,10 +214,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); @@ -233,10 +238,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); } @@ -289,6 +296,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; @@ -310,11 +319,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; @@ -328,10 +338,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); } @@ -1077,6 +1094,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); @@ -1250,6 +1269,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); @@ -1342,6 +1363,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); @@ -1416,9 +1439,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; @@ -1431,6 +1451,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); @@ -2252,9 +2274,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) { @@ -2394,15 +2413,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); @@ -2519,12 +2537,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)) { @@ -2549,14 +2566,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); @@ -2732,13 +2748,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); @@ -2820,6 +2835,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; @@ -2884,6 +2901,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); @@ -2901,6 +2920,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); @@ -3165,6 +3186,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..573db663d53f 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -671,6 +671,9 @@ static void blk_account_io_merge(struct request *req) static struct request *attempt_merge(struct request_queue *q, struct request *req, struct request *next) { + if (!q->mq_ops) + 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;