From patchwork Wed May 31 22:52:41 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: 9758475 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 5BF5E60360 for ; Wed, 31 May 2017 22:53:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4ABFC2766D for ; Wed, 31 May 2017 22:53:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3EF63284D5; Wed, 31 May 2017 22:53:08 +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 358672766D for ; Wed, 31 May 2017 22:53:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751041AbdEaWxG (ORCPT ); Wed, 31 May 2017 18:53:06 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:64010 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751126AbdEaWxB (ORCPT ); Wed, 31 May 2017 18:53:01 -0400 X-IronPort-AV: E=Sophos;i="5.39,276,1493654400"; d="scan'208";a="118884968" Received: from mail-dm3nam03lp0024.outbound.protection.outlook.com (HELO NAM03-DM3-obe.outbound.protection.outlook.com) ([207.46.163.24]) by ob1.hgst.iphmx.com with ESMTP; 01 Jun 2017 07:06:31 +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=WaEVPeubRQuhBYbrUvipxlGtiY8yyI4AALqNw/32FmA=; b=tTAwotN6lOubVjNy4mdg3ZWpupZ+RoYQO3w1Z59kO3GISj1N51MZFS0cvwEe2HETHCnvtpC2AI2U2v6S8Gta8xYLv9KL0FCnKyA9yeXzBdxLm1jKJMD5x0suI6Rd0Ii1xbw0AHy39INjfUn8rcV3t3OY0GrLQpkCPG8M1C+josE= Received: from CO2PR04CA0082.namprd04.prod.outlook.com (2603:10b6:102:1::50) by DM2PR0401MB0926.namprd04.prod.outlook.com (2a01:111:e400:3c0c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1124.9; Wed, 31 May 2017 22:52:57 +0000 Received: from SN1NAM04FT039.eop-NAM04.prod.protection.outlook.com (2a01:111:f400:7e4c::209) by CO2PR04CA0082.outlook.office365.com (2603:10b6:102:1::50) 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; Wed, 31 May 2017 22:52:56 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.225) smtp.mailfrom=sandisk.com; redhat.com; dkim=none (message not signed) header.d=none;redhat.com; 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 SN1NAM04FT039.mail.protection.outlook.com (10.152.88.242) 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; Wed, 31 May 2017 22:52:56 +0000 Received: from MILHUBIP03.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 70.EC.38445.6494F295; Wed, 31 May 2017 15:52:54 -0700 (PDT) Received: from milsmgip12.sandisk.com (10.177.9.6) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.319.2; Wed, 31 May 2017 15:52:49 -0700 X-AuditID: 0ac94371-422569800000962d-34-592f4946efea Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 6E.1F.18148.1494F295; Wed, 31 May 2017 15:52:49 -0700 (PDT) From: Bart Van Assche To: Jens Axboe CC: , Christoph Hellwig , "Bart Van Assche" , Hannes Reinecke , "Omar Sandoval" , Ming Lei Subject: [PATCH v2 07/12] block: Check locking assumptions at runtime Date: Wed, 31 May 2017 15:52:41 -0700 Message-ID: <20170531225246.26261-8-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170531225246.26261-1-bart.vanassche@sandisk.com> References: <20170531225246.26261-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrFLMWRmVeSWpSXmKPExsXCddJ5ka6bp36kQWOPgMXqu/1sFgve7GWz WLn6KJPF3lvaFocmNzNZHL53lcWBzWNi8zt2j8tnSz1232xg83i/7yqbx/otV1k8Pm+SC2CL 4rJJSc3JLEst0rdL4Mo42/SMsaAvrWLnvePMDYxTg7oYOTkkBEwkvm9dwNLFyMUhJLCUSaJ9 80d2CGcbo8SG/xvZYKpubNjJDJHYzCixu/c6E0iCTcBI4tv7mSwgtoiAgkTP75VsIEXMAlcY JdZe/g7WLSzgKjHn6zawIhYBVYlV728zgti8AvYSvauXM0NskJc4u2UnmM0p4CCxevsJdhBb CKhm05HHYEMlBBaxSlz48ZUVollQ4uTMJ2BDmQUkJA6+eMEM0aAuc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T: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.225; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(39450400003)(39840400002)(39850400002)(39400400002)(39410400002)(39860400002)(2980300002)(438002)(50944005)(9170700003)(81166006)(189998001)(8676002)(8936002)(50226002)(54906002)(50986999)(110136004)(76176999)(1076002)(38730400002)(77096006)(356003)(2906002)(53936002)(305945005)(2950100002)(33646002)(36756003)(47776003)(6666003)(50466002)(6916009)(5003940100001)(72206003)(48376002)(478600001)(86362001)(5660300001)(106466001)(4326008); DIR:OUT; SFP:1102; SCL:1; SRVR:DM2PR0401MB0926; H:milsmgep14.sandisk.com; FPR:; SPF:Pass; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; SN1NAM04FT039; 1:PD2DbfcZzqnOz7SSfdUSrEpvVw4Rznl17eq+nBTr4qk8z9tmiv2K/kU+RGe1sTs803GCANhQTB38t9uNaavOD3VLEtPrJxWnbg0rBm7/EBoJefchRSipSaz5sK9IHIwlCPqNctFRl72NGIhHoyg1o1rQSJMn+Shq3WbscMisBkiKEl6EfjDZvF7D2J6TKhydr259XnmEFXiun+rQllqYvJEpUnzY2k20GuVpDEUruyXGQsMCgKcczxyfWKY4UBhhHor4ZqC4QKNPWAAejRaDM2y9HN3nZZqyRiuzknbRvB1hw1J74D1HW16oESf+ToNVexC+WxXMarkq5rsGXJIEcRirAVa3DFXqKRAEgUmuip+ftOds20koYWC2spfrx7cAaaXAjuSxX8c3BrF6dMLwl8s/Ymo8vCW6P78tXyvYGz6Mt6dL27KqodrshkC7h8lY7ONJyRhpBu5QRTHOjrmF0GL9LDOwkpFsnj058lxBhNEj5J5W9OVIcjr/cxqqY+LXDrOhRO4fTCQn23O3VrlKt0FWM9591TcuJDDOd2aCZoc= X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM2PR0401MB0926: X-MS-Office365-Filtering-Correlation-Id: 23e138c5-7f41-4507-9257-08d4a877c766 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201703031133081); SRVR:DM2PR0401MB0926; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0401MB0926; 3:VizugZIUwwp/NdJlfXnQfVEYDzHbwmiJaUWEJUOiAhd/vavhL2Vlj2dE6jT0xqdOLTmWdYOI84EfqZfQynMeeA1qlSQkHxjsi1/MBqzfhc0+55ivMYOe9h6vnEg4kVo5NW6R6Ho9nKPoSRu0dyVODUHJTb2jZMLIuoQ+NeV/jHfhiVqdleiiKPAd6YLZi6PbzvJVDWux/TzkGdgzS9WygL+eEzPyz1oJip8+nXgVITEBCDzBczHY1ZE+PO3rXy7lunSTbyjtvclZiiDDHN6jXa0QJkYL9Gwhu+FCAz1tU1aHXQNz6jXYabxhI7hWgvfFvglVOgPuFj971/YBU/ajb9lUDYv3dFgj1RccjxCGT68TcRKldJNEKMkei9dL4Z9JCMLh8KUs3SUInJDx5kULYHSyLXdh9klvaa8CtX+zkGsTZgvwxAhWCLPlMdVhcED6ZjlliTBN676f8t6d9zboAvYicVWvPyv0m+cSHieD+l/6Zwv4z8DeucKUMAgcmOu8 X-Microsoft-Exchange-Diagnostics: 1; DM2PR0401MB0926; 25:oolmKX2+ssMEc7IxZpg0rkKBHL8AVz+VD9xAUPB40JxT8SZTCbviPRHRarhwrUwcLODDdXXi01iY0mEAy+Uw+XGS3JP9z4GPxeH+rZxF4ATJ7xViui7O9AuzfLoXG+TdgLzYPL1QeDYRe1ZHyLnlttJwcjaaryZSOL/hdDlZ73tETPsvgSb1v/WVH89hIolFbWT+GdOUFpHrpkCnEnUu/jruWh3sTm/nt+cDpCUi8GmWys/fzgw78ZCXAWZ+wZanzTrrix2Aq/wvsBHOijSKv+FIeInl5biT06aQCUiBB4pMOvS5pTRCKOHvBqN9CyJECUfWXKUW7zZdUQd1tETkh/RNFhcP+Ht/aNRjNG+mKYaHYUAKSKqp4+bsHcgblzI4Uxs0S+4sBhmriHgBHs3WdjTFdtm6M44ABGkLVFPO3xeYohGmEhr7U4N8skCUYSi2iOF1178RxeHdrNF2sHVg/lkxBNaplw4yZ7nn/n7Jg2s=; 31:2Mqq1ZXU3XPURJMDu5jMN0QyC0KKq4TczB8XAOfvGOZpSII6B/dvJV78W3fhRMsEAjVrv9+qLIbZUrtZx7bCNgo67U6Uz7BubS6Xx02Lp5C4PzmSVKn3ACdYgxQ2xWlvbzBxIhOqaI/hc9j7nPk9uPfA09Wfj6W5qXTvFfvJ0pbYPDKwCIJk4bi67TnMB4kAq9dX8Oni/tXgmtjZBmzbxHpIkhZHaYAt8PY1rf8iQ+17kiVy18b+/xFulnPo+3kgk5Yq0f4n2y7/bsiI1aGYYg== WDCIPOUTBOUND: EOP-TRUE X-Microsoft-Exchange-Diagnostics: 1; DM2PR0401MB0926; 20:X0Ngk7efSiVcJLJUGKl2qVGTarAQs5lV/f+A9gMlw1g/isSmJDqJRrStD9DCHe+CZTZKXjj32Pr0Uk97r7BILYZoh1tDjoWCaAPook6ll9Bp+5Dq50jOmb3C7hENUFLNjuqJlmM/4Dr03UOV+dhHApw19/LWqG3im4m9oG7uglSk+nXBJg8RIlTn2d4dD/NO279kJw+pGx1RX0E6hc0ADiWcoGDx0ojew/2/CJdStQAvZbLNqDE0tlSzLG7H+kPfruDaEtqqcWLLIsiodiC/nt0HLlOC4euWnUWby44H68bm3+TcqRamFu63+z+MIaDuIfuNptuTlfNWVtBF0hqpWxW17ESvrEPHehjgcRTIn+RSC8k8YlQpm73KzXOXmpqf6/W2mxRFFfJRBgIh4ny+zOu/AGrFjyihKYTqfKSLzyHFZsUOyzKXQvttz+yfGD0rO5+gFMKinZpnULamJUP8jIlh1DAOlhiekdNitb3ae8Rv2ClQNhEyw+Zq+cbvg+oS X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700073)(100105000095)(100000701073)(100105300095)(100000702073)(100105100095)(6040450)(601004)(2401047)(13018025)(13016025)(5005006)(8121501046)(100000703073)(100105400095)(10201501046)(93006095)(93004095)(3002001)(6055026)(6041248)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123558100)(20161123560025)(20161123564025)(6072148)(100000704073)(100105200095)(100000705073)(100105500095); SRVR:DM2PR0401MB0926; BCL:0; PCL:0; RULEID:(100000800073)(100110000095)(100000801073)(100110300095)(100000802073)(100110100095)(100000803073)(100110400095)(100000804073)(100110200095)(100000805073)(100110500095); SRVR:DM2PR0401MB0926; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR0401MB0926; 4:gfKQpGbUZ1lEtZyO7qFReoQUnzml/leDVFV0kCy8?= =?us-ascii?Q?rqy+KDdXGcVjSBsh/nnsW4WwxgaedTtt1HxE+PFWzkoZs6tVzYlKYf3SFxPy?= =?us-ascii?Q?H3LAM0/Rb+XDyjJk/KAT6ugK26m8JPRSzYwmuh57t6YapZ407Xh1IDkMGqjV?= =?us-ascii?Q?/bdh561JB5GSLETT79cDsnJ7oAlBUFjfPybm7lKP2UvA1aFWhqnUbZjwGm/e?= =?us-ascii?Q?qPAfSzTR2a4+wOwPkX2Al6XYFS1MGcK8WB1j9A8QLFGeP9KEqVVCw3hqF4tE?= =?us-ascii?Q?3SebLhxYe1CKFXgVeyH7U6MTjM9z9gKI2AB5zpQ2vwcbmgqxSn9MJDAAlbGv?= =?us-ascii?Q?0odXlrQm18emkZSaemcIcAJ6B1+VKu81JmFTX9S8OQZYtfEa4UDkZq32IowQ?= =?us-ascii?Q?Qa7Em6wSHpG3CHTaQcwAM+8vp6dIAlSiSv5I3dM9jhqndLUjLrJc4ILZ80mR?= =?us-ascii?Q?D+qHGfTPVB7AMOyfIiQWshp8YQeXkREvI+6qtTCvSENnw1+4Z9RXgXxn9va0?= =?us-ascii?Q?ckaIeXIVpv5qYQiMNFSII46qoTl8XjewX5qazDGe94+meDMG1S1I/1NYReyK?= =?us-ascii?Q?g7X5GJNvnK8M0HMBtifzgMmyo2cTYTyqyVoblPfnMuODu5LqafHhvH7NBg9J?= =?us-ascii?Q?/I+blpO+vJlrJTG7kH4CF59i2YZCbwx1pEVkL/H7cAlTVrSJgn8eTtT+GQc3?= =?us-ascii?Q?4YZe2GovOvObTXVd6fN1EFv3EZcZj8/ZoaHlBA5+Via2uemUgp8pP6gajaVi?= =?us-ascii?Q?tLRjrHoEHOOU1KXJ1ELa9YyfgBzsG8TzB9thJoMw5LOL8vAksHm6pOQuL6z5?= =?us-ascii?Q?AtNoWk/qUSQAn4MkdwW8ELv7yFqC8YyVuFR1dGdPEo5+O8rTAvLbILqIBfMG?= =?us-ascii?Q?eSDE3YK0WQYjDZ8vbqfREGidz/ueYtu9aMcMvRo5zElXQ93G7iYO5fxDpgOT?= =?us-ascii?Q?PsuJNxSBlCVHvwPKMcTv9zQX5FE98FWRHXn3fkOXjxbxERUWIJs4jYoQa9n7?= =?us-ascii?Q?qIGyY+O/5d3TmuJOtNNv/oOYVsCRqucriv4WmxF4DSb/lymyYSEpXIF2oHP/?= =?us-ascii?Q?zWffJ2z6SdrVqzupL9KcKT9s0S/7cYkOwf0Jf18/KHqQJLYHGtweKpbk5zJd?= =?us-ascii?Q?t1FGDA8qyIQ7wJbHanImLdTEqZjArdpv6mgnK6ydP/OPTuP1f83nGOhe8L9u?= =?us-ascii?Q?C5pbKLq44CtcaplPN+HYK/IVzExU0P/6wZVCRXEHPhyc1Pq1057ML0NXcZe1?= =?us-ascii?Q?/H3NUd+UO+lJGBpNrRR5cVpAHguRjgnP1LygFAnoTQS27gWZQhJbBn7vvrCv?= =?us-ascii?Q?qg=3D=3D?= X-Forefront-PRVS: 0324C2C0E2 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR0401MB0926; 23:adGxMxckGH/aN5nnOkWpcN/UnpjDuBi51dGBxRi?= =?us-ascii?Q?e79VD/vteGSWqT1nlz30xnaKdvtvk2C91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?Q?KxWCokQkCSxoR/nfD0fUO479+7grJ5MlgJe2W4+1z5lAzttQdrQfEaboK/56?= =?us-ascii?Q?gp7Wv7XtduGdYApEj3HN5hv55FX5bhZAKWw4+N10FGmqewzwzPnDurH7vo7A?= =?us-ascii?Q?IsFdMbpPecHKsqF9BFILK6PGwt9KE?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR0401MB0926; 6:kZBwRCNZEvQetSVR8Rgw1H1Z2FK5jmFECEahtATWRDjYfyWUmEUgXWH0sglTMizYsoFN6vzZ9qpD10Cnv3NveWBeJ0V6QADx/217VzDH2BpeSiBPFbRB+UAMZ/KS0aMhGgUk+SLuOwpdG90B7Khy+ZPctw7cd1QWSl5ZSIWcdhlBMXiTpeC4ukgxdnxhtvcS8PCfOrlkBXZtbMP9oUvtYoLmeFUA39iA8Ub5lzmBKfrRdife2cOehqqqIibyA5otkUmmRYwJu/PVROAgsNN9NOkJ4Gq+eJRSQpfwSBfdv66xwBNLd3urGKv8C068elU8SSwWHwqdwwKziUq85fLTHCNS6HRLsHtq0AA9f38BNHalYD++DtLgaulJnvtACZdXDgoURTATf/83BiiCUuFw9/61KJZySHAdN/mF8CdbxZfiUbANg2KR2XPezqcY+g2e+caopB3yr6/xIDpogvO1rMH6sZpqlbvQblCkd1McZyRbM+TApOy003n1CKDAIrIDnoI/PoeSOKnVsFZayHCICcGUDuAFyuFOi4dMd1nv6rI= X-Microsoft-Exchange-Diagnostics: 1; DM2PR0401MB0926; 5:XOR16JYibE/qBuA+xdPFqWFNNcYh9YbHFL8zi0bzC3BqLywPWBBKAYZlwWt6O58w/m7hczZ/VytzfxlmwwXNp7bUIk34vdB1If4B8EC+DW6Z6FAOouOGcNThmB+8VYQOynK3xDUtVorxbZESWO3geNZ4p4FJ/VSaYdw5x1XLZn681ycFOucE3r7Sw1R/YusWNy4/cAgK3+bJ7cnO/aikxPgFdyV43bqA517B9G0iZOjZXaom210j1wRpev9uCKgmcpSF5/8I7GFBT+TZ0zIdzQBB4Zk9y2dN4y7pyi7m/W9g3/HDiTjRhc4Ae4PeTCaLVyFTlDud6mCS+a/gC6Qw2CLG0RsDyPzU/AuoV0MMgfFKRi6wPxyvgA5mEebbh0O3NXz0cGGMEdCNGdCj5KxuYmpAow9Iy8whkS75JVPXIJCfKpJUMR5Mxn/W8ZnKWyyWf88kN1ykiCOkG6ULyTRa3Uv94u9SyJVNWLKCu29Gwa39Oi2tcVTbmMMO70QIZCgM; 24:uH+sW7Vhpgnofn+BOiAfcGJQAgBfV60mBEA1j4ggB8FFbUHjoYs6KhXrRW6vbJYSJW4Y5A33cD9cPhtiSNDQMoM1TuxuSeEN2MZX70ZesCQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR0401MB0926; 7:MfjYgJoAnBC0Qb0QH+YQvWCUbNHT9dZ46h1vtu5kKEGSlda20gS4ZFMlqe1UwlwItluNP7XUiHCVs5XlZ0uywGF6im1ugjFrV6OcX0nTDCVo07hqGegn5KFP7TuyNgRigBaP5Zq+sX6CNsrqpzmjy+QpmhVTZLyGJcBp+0UtJTW9OAPOoumG53kSe5PPh/K6mgnBw61vkpNcAfAH5NMQInz607L9WPOcMkA9ty4u1td8fqSuhz9NjvA8+t+v5WFX8laWlKbMB91zhLk06BSriM64V4Or69LjijJKNuui+73CeEC3YokoxPEvOmGmXszyEL9wDhcc4WLZtQB2Dqu++g==; 20:38QPoR/kR00Bh6s9jfzQi3gOyFtAou3+uxGgTfKazbYhHSHTnbbGPArEOiRTjajGJBSLZ3/8LghujUwjqRc9QAaeVFRVxviJQEu/R5OV6A9FEIkfhhBzFh1PNhj5HqVUfg+aXrU4tS4srps6VHhFPmSK0nyGaBQXvxJbVLCJ8iQ= X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 May 2017 22:52:56.0263 (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: DM2PR0401MB0926 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 Reviewed-by: Christoph Hellwig --- 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 3f68bc1f044c..f3ad963eccdd 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); @@ -1336,6 +1357,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); @@ -1410,9 +1433,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; @@ -1425,6 +1445,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); @@ -2246,9 +2268,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) { @@ -2388,15 +2407,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); @@ -2513,12 +2531,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)) { @@ -2543,14 +2560,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); @@ -2726,13 +2742,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); @@ -2814,6 +2829,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; @@ -2878,6 +2895,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); @@ -2895,6 +2914,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); @@ -3159,6 +3180,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;