From patchwork Mon Jun 19 22:07:57 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: 9797961 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 DF31360381 for ; Mon, 19 Jun 2017 22:09:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C696926B41 for ; Mon, 19 Jun 2017 22:09:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB07026C9B; Mon, 19 Jun 2017 22:09:14 +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 A0C8427480 for ; Mon, 19 Jun 2017 22:09:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752175AbdFSWJL (ORCPT ); Mon, 19 Jun 2017 18:09:11 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:10615 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752707AbdFSWJE (ORCPT ); Mon, 19 Jun 2017 18:09:04 -0400 X-IronPort-AV: E=Sophos;i="5.39,363,1493654400"; d="scan'208";a="27623338" Received: from mail-sn1nam02lp0024.outbound.protection.outlook.com (HELO NAM02-SN1-obe.outbound.protection.outlook.com) ([216.32.180.24]) by ob1.hgst.iphmx.com with ESMTP; 20 Jun 2017 06:08:21 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=b5zzJ+zGVgYgyHyU48Wlmi8CJsPKimZf3+ZIH3Gbzv8=; b=OP+c1OIrLShlOtu5IPvi8CFhoKONZCYjbDpFqDxO/Vyu+DSSoLyQsqNJ1d43IBbGXynbp1te5ULqlcnwbcOZ1fNALZEcaAfS0WQVnl9R84zFpGE96ApSY+RYwMec4FUbZZ3KGGbEi9+KS/qjjCko3Oow4gxi6YJblTVf9qx3veM= Received: from BN6PR04CA0016.namprd04.prod.outlook.com (2603:10b6:404:cb::26) by CO1PR04MB540.namprd04.prod.outlook.com (2a01:111:e400:103e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1157.12; Mon, 19 Jun 2017 22:08:17 +0000 Received: from CO1NAM04FT015.eop-NAM04.prod.protection.outlook.com (2a01:111:f400:7e4d::208) by BN6PR04CA0016.outlook.office365.com (2603:10b6:404:cb::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1178.14 via Frontend Transport; Mon, 19 Jun 2017 22:08:15 +0000 Authentication-Results: spf=fail (sender IP is 63.163.107.21) smtp.mailfrom=wdc.com; lst.de; dkim=none (message not signed) header.d=none;lst.de; dmarc=none action=none header.from=wdc.com; Received-SPF: Fail (protection.outlook.com: domain of wdc.com does not designate 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 CO1NAM04FT015.mail.protection.outlook.com (10.152.90.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1178.14 via Frontend Transport; Mon, 19 Jun 2017 22:08:14 +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 D3.03.02805.D4B48495; Mon, 19 Jun 2017 15:08:13 -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; Mon, 19 Jun 2017 15:08:09 -0700 X-AuditID: 0ac94369-9c18398000000af5-32-59484b4da166 Received: from exp-402881.sandisk.com.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 88.4D.11415.94B48495; Mon, 19 Jun 2017 15:08:09 -0700 (PDT) From: Bart Van Assche To: Jens Axboe CC: , Christoph Hellwig , "Bart Van Assche" , Bart Van Assche , Hannes Reinecke , Omar Sandoval , Ming Lei Subject: [PATCH v4 08/12] block: Check locking assumptions at runtime Date: Mon, 19 Jun 2017 15:07:57 -0700 Message-ID: <20170619220801.12557-9-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20170619220801.12557-1-bart.vanassche@wdc.com> References: <20170619220801.12557-1-bart.vanassche@wdc.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOLMWRmVeSWpSXmKPExsXCddJ5ka6vt0ekQecRWYvVd/vZLBa82ctm sXL1USaLvbe0LQ5NbmayOHzvKosDm8fE5nfsHpfPlnrsvtnA5vF+31U2j/VbrrJ4fN4kF8AW xWWTkpqTWZZapG+XwJXR3lBf0Jle0bDwInsDY0dwFyMnh4SAiURz3x6WLkYuDiGBpUwS/64u ZIRwtjFKvPi5gqmLkQOs6uQuHoj4SkaJVQs3s4N0swnoSZyat48JxBYRUJDo+b2SDaSIWaCJ SaJlwg9GkGZhAVeJs2/iQWpYBFQlZn5ZB9bLK2At8fHGEiaIK+Qlpr3rZQWxOQVsJL5P3skI YgsB1Xx+PwHsIAmBbawS/zqesUI0C0qcnPmE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PAttributedMessage: 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)(39410400002)(39840400002)(39860400002)(39400400002)(39850400002)(39450400003)(2980300002)(1110001)(1109001)(339900001)(189002)(50944005)(199003)(9170700003)(47776003)(33646002)(356003)(189998001)(8936002)(1076002)(54906002)(53936002)(478600001)(5003940100001)(105606002)(72206003)(85426001)(86362001)(50466002)(50226002)(81166006)(38730400002)(2950100002)(36756003)(106466001)(50986999)(76176999)(6666003)(305945005)(6916009)(5660300001)(8676002)(4326008)(2906002)(110136004)(77096006); DIR:OUT; SFP:1102; SCL:1; SRVR:CO1PR04MB540; H:milsmgep15.sandisk.com; FPR:; SPF:Fail; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM04FT015; 1:LyzK9TWTSxALEFmy02h0vD1EpZIWxxzJ3uwU/pyWJ4DiYY2G3xFIs75CbnrhydE/30Feiluk3jbk3YzoaMPoPEkCfY9a4wr73pnG+he1JNvqnOPy0uSPhdrAfY8x57u/5o8OXVyM5BKAB92FGXICaaWnlVKWL3The+7bllE5vlcdhIJrZGbkipvn/BIOKdpV60dr9pzQL+6t17RniagXz+68HOpqNXsFWHtUumE844A/4GVVaZv0jFv9gRizrTyLid68tNJ+9RoOt9G1g3mgQ1Itd1E/QnVjYkaNBwShTr+ZtKpLRa1f70HNyFs2g0woWCXZqpO8ax3f+oSd+aVbEZifFkuKQdmsEkTlDRfz+wXoguFoGNjyfk7fca7I2sjWuHlYPcZ0YedsrS7n82IFRqanOQJnrdSwz5ElWJwUlp1Kh+o60CjCVt9HFDb9w0YZJx6j+d4DQ1uZdz89N87MNRSKIYIc6Qzym251sZXCKWtk0QkIuSYfib6pPCJgluSZJW/VlVyi2kkPp0bSpOcB0BvirCTaDkJzOA/2iOiSf9PuLVJ8bD8+0Yny1T3ALyVe X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PR04MB540: X-MS-Office365-Filtering-Correlation-Id: 34849d7f-7ebe-46ae-aa14-08d4b75faf13 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(201703131423075)(201703031133081); SRVR:CO1PR04MB540; X-Microsoft-Exchange-Diagnostics: 1; CO1PR04MB540; 3:MfEM6etZQxZk3rjpNj45YzVqs9AY5WJH0vvBFCMd3hE7vcVpPCpvarfUPDfFOzZdMlQYKs37jwQLzq3gHqSfy4lmPBOhoN6ACUJhVS8RQaFK+6GyQ1IbfKw84/p96Hg/P7p0v6JoV1Gcj2iO9d4ziY7OD+NpZ4LS+o06MF0Eey1vS9sp59fxbixDbmM3eRip2yx36r05JjWBFx7PT5ecpWZ5ghwNfHbZpaO4MgqmXRHOXjJKPteF7EdjenCxH6qns50LLWrycWsiXWDQzD/32Pous/8SuRjVrjvKzM1gR16BH3s0UBR9NU2fHHBuB9+IgtK/tfpDNW25lb7TzKTq5XdDAhU+BkMdWAfNM6iNQe7Zgk7T3oWi24nt3fYj0bO4GdUnwdEqmLgWIkY9SupAtvVv6sbvoDzV4Dmf2ouUqGEg+jkHGkVJz55hT+HWQgNc6otbcHu7NFEOGBfT96dslg== X-Microsoft-Exchange-Diagnostics: 1; CO1PR04MB540; 25:Cm0oifYBDDKxiaaiNtcccbpWiOyGRUEsF8HkxoaGaNjoRc3esCJen6DAb07XhU096NzmoBxid3EhF37AFnzTDCURZtL/uZbHnFo+wlG66+tnuX6GxSsKL1afWKj+0RkyN1faLOhukj+l56kr98+CfsEAqqQ1Zfgi6rC+N/6ycrJrcyPjqKo+TSfvAi8keiH86doAAUV8DzqEnVLAXX12tBerlMtQn6mxmSxnVhEONcSBPrbSsR+AjVNoylT/O7aoFtYUBDFRoq3YsQMVTG9Wb270BzW4soJWAybM0EDErCFLm+ERDAWuGWlLE5oQLHAKJO2EzQ3rwOMtUEiE+99cVrSevD1t0X2yqApdWILsBI3pvKu3M15jKq8jk1wkIqlC8tJ9yq5INLLrIHJry6hqStwtStn+TW8VzzvojgBMZ9JI9MP2f6H5cq8Jk4luZ2P/2KMOH1o9VxEzf6klgAlpJa9SmOWlpv13hN4smuGgGBs=; 31:7kbxyF3GA3PZqHnhZAYNhiUCscRZIKXQ7ZF+juRl5K5JjzkYaXuFCJyYsHKWMyIMoo6adrCMcXPPOyszKs0vFp+Bs5GQrSmpipDaUO1HaPnMMsohmvLLKzNggdSezlLf2gaDWFJI9qCAuKwspAvgHa1lc7Wsh616MxQm/oZoRq4f2p/bNYWzlbPqhKt/D2GDUxF8jrp5/0LPKiM9FG6aTzXMaZqYeOH6TzH91Ku1/HRRIqDRKCkxxw+KPkd2gszJXfkVdEFY3uJQ0ZEuMaEk8A== WDCIPOUTBOUND: EOP-TRUE X-Microsoft-Exchange-Diagnostics: 1; CO1PR04MB540; 20:UdKV1Qled6HDOjdFYnxyclGobV4curmX1SGWTCo3bmO1cW9htQ6U/GoriBbcFdU7H6q3bVoY/Aey6DZGtNoFC2hRW6QKwWe+wjXQoczEnmpzKmcUdpxMCiqgpvkYbjH3kQLMxdgLBsnsVJJUOwcBoNJLwJstskn4tBUqzOFKR/mAc79Rc5/nhMZ2IE48VP2QuP/Wcgj9a02cY5aHDG0BZCOfnBK/68u/uydyceR1snvDPqrrMqRqhu1EM1kj5/qfuiWl4AHqqeUxYuncQayj2SqGuDteZwxf6A1CfpjHctihnQ5rHPjKdWJ4KC1sRGfz+0HZZO6QJ8r6BQ7rFMxevhTdlN18D+qhWambfOJVbEbfWkljMGs7MtSLkgFLfaVh/Js7Am5ZqSYXC2s31LeKDOH9iygi48HhlbQoOeAwbkTyzSM7nJ1BvRVV3EUZvm9Qexdt8g/vhGrrdtOoSgFzlnYGHjgEax7uEVJPrg8L8/9Q95wULhFrjBh+WpMH68Ax 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)(8121501046)(5005006)(13016025)(13018025)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(93003095)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123558100)(20161123562025)(20161123555025)(20161123560025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CO1PR04MB540; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CO1PR04MB540; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO1PR04MB540; 4:HohEIA2qCu+othej5vjh8Z3Zx88Nqly9kll9g5CCSxP?= =?us-ascii?Q?kY0ov0BIJ7e3k6+NDwFh7TgCBEwwONe35rLxnS6ZMC9STkrodz6duKhR1ESq?= =?us-ascii?Q?WY7jXzY63hSGbNb/hVn3TY0xsSM7fcDtOSDSwPYamFswd0Pw3/Xz0/ClSuee?= =?us-ascii?Q?/LQ6x25Iy+7W8nDY8bIp0RttShY4aczrPO2wb7kzOwR9lcfOoloUeAFgXJLu?= =?us-ascii?Q?1GLfd0AxiIzfUGdWj5rPIQW0JIVUBK8iLstRy1N5V6aSuBZJrnJs5R8XcHWR?= =?us-ascii?Q?p2ER8cXlE9Hn6O6JdZGZr7NNzgEFeWNgDMl+lWLAv+JpujXGxCYPuI6mPdta?= =?us-ascii?Q?MzO3P52+Yp21xGFKxvcMFs/vyN2SHbltSAdMFb73gmed+QJWWNqGvL6lkHU0?= =?us-ascii?Q?i4WjnxvVGxn5hFoOyTQUiTHCEDicnF2K8kh3faR3q7jFbfxP9iHxi2ujcPMw?= =?us-ascii?Q?8G+TVmQyHFdEz6Oc//cYNANRiva8cH3rMvVSwsz4fptrKKM9ir3x2Syf/bBd?= =?us-ascii?Q?aFANZNFjxiQCVKHqnWUXADNwu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YZpBnMEgw?= =?us-ascii?Q?q/ZKbYUax1ypuEjHtHDuQprioo1EckMWNZIrwht2Gn5ZISfgRXQKd4vyzJCK?= =?us-ascii?Q?QBXFJADv1KzpYCS8jT1qtecMLZ21mEG1RugsMMCDtIhJfr8os6fhQwlhiFvC?= =?us-ascii?Q?LmidNXciUm2oPYBliIEbdcTfywVxng6ER0vktMS/IG8u7i1i1vHLpQBpfViE?= =?us-ascii?Q?ajvNATpL0oZ0W76Zgl1JSFxMAsYxV7twlxSLGEOSVFwexur/X/7hVO3wRtvw?= =?us-ascii?Q?4wNL04Ss9EOq8=3D?= X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO1PR04MB540; 6:7LqKTV/hMGjuTolhdZPJ2U6FiFvbl//brLPFSOnqZ+Q?= =?us-ascii?Q?0lvKrZ2PW1a/I5Xu6LeGL2yd3/wgl9mXfmpVcrByWzLk8WdEoF1Cx6teS3o9?= =?us-ascii?Q?Ksahx7qa1wufdGq+BgstL9H1x1TOck3D+mkMYoBjBKFue1APfAnMdiwHoa+V?= =?us-ascii?Q?dDpJmtYoQdexTlx8uTicNS7/qhMz2uE+weDh2Di0a3aI4IDvyts+ToFDh1Bi?= =?us-ascii?Q?2wgxBonczGMBWCRmfOu01bRR9qLp65gyEcaVu5xl8SIC0Jv9iQEuoIIwl9Qc?= =?us-ascii?Q?SfYdxAhC/Sd6YXshldetAGTWFgtBbgNSSzptNrgynf/R31v7G36E82c3jfsq?= =?us-ascii?Q?WF/6KHi4E5dsluwN5pLj2O9Ki5DJPfWYXjFnv1aDGGSJnnP4J3W+1qmn55Wf?= =?us-ascii?Q?T2APnOj1YuKmUMMcOhXMyVlRJV/agV+lUvpLB1hovyeX7Vltfojl9rVKyOu+?= =?us-ascii?Q?VV/vC7HmF1K54O9Hm48N69i+esSj0BRSv31P8w5+tuH3iJXSVGqKI2FLmznl?= =?us-ascii?Q?rxstSU8TEsn1pXmf2z7ak47bWxBgJ//ETqwoTBvHX5A6nZlGxV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9+mjdSUqFlmotlpsA7x2FaKj803USXcsG4ZM1m8+qtRPHU4WqSJoHAt7WkR/KjotqVhXn5O/WVqVv8ztdO4F7sszRJ/0pDvOQnLhhVyjttunSVQ9wDFZzxvS2Qs0YXjCEgaaBpnfItP7V1YQlZ3lR7iziRtSfFflZd4= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2017 22:08:14.9097 (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: CO1PR04MB540 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 From: Bart Van Assche 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 Reviewed-by: Hannes Reinecke --- 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 0c08cf3559c9..5eeca5ac547f 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -235,10 +235,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)); @@ -256,6 +258,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); } @@ -268,10 +272,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); @@ -291,10 +296,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); } @@ -347,6 +354,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; @@ -368,11 +377,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; @@ -386,10 +396,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); } @@ -1135,6 +1152,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); @@ -1308,6 +1327,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); @@ -1400,6 +1421,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); @@ -1474,9 +1497,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; @@ -1489,6 +1509,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); @@ -2313,9 +2335,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) { @@ -2455,15 +2474,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); @@ -2579,12 +2597,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)) { @@ -2609,14 +2626,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); @@ -2762,13 +2778,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, blk_status_t error) { struct request_queue *q = req->q; + lockdep_assert_held(req->q->queue_lock); + if (req->rq_flags & RQF_STATS) blk_stat_add(req); @@ -2850,6 +2865,8 @@ static bool blk_end_bidi_request(struct request *rq, blk_status_t error, static bool __blk_end_bidi_request(struct request *rq, blk_status_t 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; @@ -2916,6 +2933,8 @@ EXPORT_SYMBOL(blk_end_request_all); bool __blk_end_request(struct request *rq, blk_status_t 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); @@ -2933,6 +2952,8 @@ void __blk_end_request_all(struct request *rq, blk_status_t 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); @@ -3197,6 +3218,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 a572b47fa059..ed5fe322abba 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c @@ -346,6 +346,8 @@ static void flush_data_end_io(struct request *rq, blk_status_t 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, blk_status_t 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 cea544ec5d96..5df13041b851 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -648,6 +648,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;