From patchwork Tue Jun 20 18:15:45 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: 9800069 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 1056460328 for ; Tue, 20 Jun 2017 18:16:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 112BF2624A for ; Tue, 20 Jun 2017 18:16:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0592F281E1; Tue, 20 Jun 2017 18:16:19 +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 029762624A for ; Tue, 20 Jun 2017 18:16:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751056AbdFTSQR (ORCPT ); Tue, 20 Jun 2017 14:16:17 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:14687 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751030AbdFTSQH (ORCPT ); Tue, 20 Jun 2017 14:16:07 -0400 X-IronPort-AV: E=Sophos;i="5.39,364,1493654400"; d="scan'208";a="26836445" Received: from mail-bl2nam02lp0079.outbound.protection.outlook.com (HELO NAM02-BL2-obe.outbound.protection.outlook.com) ([207.46.163.79]) by ob1.hgst.iphmx.com with ESMTP; 21 Jun 2017 02:16:06 +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=HNgiv5LnzSndkcvAh6C9lNyTMR3YUeqozTl57TvlmUc=; b=mYb9Wz0B2wV2XLikupl4ifIBr22fVSQhfbFpIiTWVSKc8V97IkO6yQ0Dhyaf8EcJN8hLfm93GURK4TLta5hYtvZbAjBDYm+f6QHvX3xFwA66BKcJp9kQSabVWpNiO2SI+Wq5SIuIt6AkSWA7IXkz2OlIGUyftTPCEWsRqm4hmso= Received: from DM5PR04CA0040.namprd04.prod.outlook.com (2603:10b6:3:12b::26) by CO1PR04MB539.namprd04.prod.outlook.com (2a01:111:e400:103e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1157.12; Tue, 20 Jun 2017 18:16:00 +0000 Received: from CO1NAM04FT015.eop-NAM04.prod.protection.outlook.com (2a01:111:f400:7e4d::209) by DM5PR04CA0040.outlook.office365.com (2603:10b6:3:12b::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1199.15 via Frontend Transport; Tue, 20 Jun 2017 18:15:59 +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; Tue, 20 Jun 2017 18:15:58 +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 2B.16.02805.C5669495; Tue, 20 Jun 2017 11:15:57 -0700 (PDT) Received: from milsmgip11.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; Tue, 20 Jun 2017 11:15:13 -0700 X-AuditID: 0ac94369-9c18398000000af5-e5-5949665c9256 Received: from exp-402881.sandisk.com.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id F3.5D.11415.85669495; Tue, 20 Jun 2017 11:15:52 -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 v5 08/12] block: Check locking assumptions at runtime Date: Tue, 20 Jun 2017 11:15:45 -0700 Message-ID: <20170620181549.24903-9-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20170620181549.24903-1-bart.vanassche@wdc.com> References: <20170620181549.24903-1-bart.vanassche@wdc.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJLMWRmVeSWpSXmKPExsXCddJ5kW5smmekwbo5vBar7/azWSx4s5fN YuXqo0wWe29pWxya3MxkcfjeVRYHNo+Jze/YPS6fLfXYfbOBzeP9vqtsHuu3XGXx+LxJLoAt issmJTUnsyy1SN8ugSvj8MwOpoLO9Ir3O7vYGhg7grsYOTkkBEwk1l37xgZiCwksZZJ4s8qz i5ELyN7GKPFr+1RGmKI1rX+YIBLLGSUmbf7MBJJgE9CTODVvH5gtIqAg0fN7JRtIEbNAE5NE y4QfYN3CAq4SvZN/sILYLAKqEo9+vgBbxytgLdH47jQzxAZ5iWnvesFqOAVsJN4vOc0CcZK1 xNfv98GGSgisY5U43XeEFaJZUOLkzCdgRcwCEhIHX7xghmh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Message: 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)(39850400002)(39840400002)(39450400003)(39400400002)(39410400002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(50944005)(189002)(199003)(9170700003)(81166006)(33646002)(305945005)(50226002)(86362001)(106466001)(1076002)(105606002)(8936002)(5660300001)(85426001)(356003)(72206003)(8676002)(478600001)(47776003)(77096006)(110136004)(38730400002)(50986999)(76176999)(4326008)(2950100002)(189998001)(2906002)(6666003)(6916009)(36756003)(50466002)(5003940100001)(53936002)(54906002); DIR:OUT; SFP:1102; SCL:1; SRVR:CO1PR04MB539; H:milsmgep15.sandisk.com; FPR:; SPF:Fail; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM04FT015; 1:8T8pyP82ZQl9ytXMsOyJvAOO6EIJMo8UNoMOhRdOLKVMZzcP2fAu+6hOVsv03MDzp3JBa2MiPdQm2pF8IxG+j+0oiSwzwvXFWD7j9/vdwyKf4h0WYFY9DozVN1VugWLhp/YG6lOlm3QPhk+sMKyI361Uco93oZw+/gYS2PFmhZ7awkT+gqSG7jdj4WIf+iSMp9c/FmdmDxRmnzDVyWAucKORCQ5SFII8iK5UR4JxvArJS5vuCu0+WFcOCm3avXuOYcpwL5Ko3Xkm49Iq6pVt/6hQ52fAKpacLHaCfC8Qi9GK+37ZWWTePknGddo4hzydNDt0moXg2ihMojJWU2qbvhPsMGXdCJDrJAlQo0lECYs1hduBBh0IitiqN6sF7THXZHULZ1YGQAObT4LrjMu2L4VuMwFw7GmPFoNHCfBEA/l19sm3eZwgHXbZRN8JlUwDLK5NqDbyqc6277XYwitzZBP6rP+u3qErxzHaol3jmYK8LDa+Fhbz1y1YzvUKny5fMybIns9WQw491ia4Jl5jGJUdXJ53qLZcBXHtG7qBZlIeKIG7mG+P4Xoa0UssfAQ3sRHWx4EMO+OYJPiV0dVD+5v+hQIM/zeO5AeRt18KPhxfHQolDjpJxOFrn65q1ppHqq9w0SDBVAOady714zX4Y9/kt0HFsd72RyLRxv9vUW0V92rGTYIAFO5pMR3ezsbMbgA3uE8nMUss50lvW0P9+SJdYLvUi6Zn3LE6SesyGOA= X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PR04MB539: X-MS-Office365-Filtering-Correlation-Id: bc338742-7f76-4fa6-2662-08d4b80866ee X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(201703131423075)(201703031133081); SRVR:CO1PR04MB539; X-Microsoft-Exchange-Diagnostics: 1; CO1PR04MB539; 3:+8gsHXGXUw1CmwI2+uLU7XvVYQSXJJQZkXoWO60Ukdnf+EWKsofqsRuixppkX/hTdLswkMN52QPtvVuZ+pvRfdcu19ZV1Hqr+l6sdUGrCxgN/RN+ABSL6vMApsvzCIip/0GKiLIjWQA6Ej0p5ToY7dqudgM5Enc61Q47N+Gsem5bZ4a65gkPgpDWobGgOD7vCrkQKiNOy6cjUzYjKI5Ru0IAyvCfZ9Su7ZBsWIu1XXGWu90SSS1dNvyCFuLBm4dA1hy63NgZ9m/hOwNnbNNz5WJCGDc7o85q5QxnxCAH8PAY0alvshWNMtx2fVCjabJrD/QnC8jNVFB4mURvlDSIUwXLaBWF1eAW24s1evhipA87qfB4MmGRWPCXc8tPj0+MXKnrkYl+uVnIY10dg8Rm6YMPKSj39fCsfhE2neoxbB+QTxnbPWk3YNVRyh/tW7BBL99FVLc2taFp5SdS07le0Q== X-Microsoft-Exchange-Diagnostics: 1; CO1PR04MB539; 25:nRumF5NsCscbisbCK3QtiYZtIAlcvqEaQMVnCDpajd2QHVUD3P7Fc/J0PsQoCOTVZfJASeRgKFIFsZYChVtognFilkaDU+GfaEXaZq5pLoFUZ1pY/1BlVfvvl+7qfDL3ynI2RoSIEhN52xuKLRvL4enwSKo1TljGTNVhcSciAt1TAAgtaqs+eUqNsqyjAt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JM0l7AABJezyaFo3C+9gULAqcKBSUO5F+0RMrouzuqSeKNl9acBRU3t90Ukv57YN 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)(13018025)(8121501046)(5005006)(13016025)(93006095)(93003095)(3002001)(10201501046)(100000703101)(100105400095)(6055026)(6041248)(20161123558100)(20161123555025)(20161123564025)(20161123562025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CO1PR04MB539; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CO1PR04MB539; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO1PR04MB539; 4:jU8/hFVDAuonvrCC1Wx2VDSjCIMxhFZJJGdbJotB/cx?= =?us-ascii?Q?jg66KKiVhgl4BievXW8jAsVwB9WtF1IeMHLZia9HVEF39Csa4+9dCD49dXeC?= =?us-ascii?Q?WhfyH/tGxL8LzIOpZQdi4q/o9u5pm2cylGR7uJo+40P6Zgx28cWoXFI8O1bC?= =?us-ascii?Q?dFLXjT5Q+hQnVJuV0/3v3VwHrr2OozK2U/hbYDnYtJbn50sHP2wqJRSlBfg1?= =?us-ascii?Q?X/l+cxiBnAWNeRBIN9nFx2nJ14TU4J/hr12cTw3fLGYO3OsMROuo6yIr85iB?= =?us-ascii?Q?VfibE7aUU7fXfqr9wGGKAUFAU7jjXDWriiqB+86oHWpu1/oJtq2FDlH1Xqr5?= =?us-ascii?Q?NLgvqxCSwyKh38Eazy+D8tiaHYkAkhpjCATdU1rH/333kbWd2wXmrATPQ+z9?= =?us-ascii?Q?BW9VNMb8Htvge7xxebm11Clux7XSmQ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7462BOigMcpHf6RITV/cO4OYDRG+6SkIOrMSneN/MpXbyue7q/8eOQW517sKpLlVWICibUupSukmFTescEiTR3Cd0B67YYOpSTdeN3BATqg8savfr1Y= X-Microsoft-Exchange-Diagnostics: 1; CO1PR04MB539; 20:Bem/K/IdK92Z5VSKSYP7Cjl6+zzW3qfqd0g+jcrYWhwsNE/bvWulCLyJl6m2uxfi8ftDJ2c8ei00rZiWFNaQos0u7u5FutAWIABgqalkCoUqFaeYBPCfpq/8I6l8GrFCPIE7pd3BG2CssYpoAPgiR0PrBbU+A0u5xy961U41DXQ= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2017 18:15:58.5027 (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: CO1PR04MB539 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 09989028616f..5f87788249ce 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -236,10 +236,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)); @@ -257,6 +259,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); } @@ -269,10 +273,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); @@ -292,10 +297,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); } @@ -348,6 +355,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; @@ -369,11 +378,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; @@ -387,10 +397,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); } @@ -1136,6 +1153,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); @@ -1309,6 +1328,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); @@ -1402,6 +1423,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); @@ -1476,9 +1499,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; @@ -1491,6 +1511,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); @@ -2327,9 +2349,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) { @@ -2469,15 +2488,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); @@ -2593,12 +2611,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)) { @@ -2623,14 +2640,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); @@ -2776,13 +2792,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); @@ -2864,6 +2879,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; @@ -2930,6 +2947,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); @@ -2947,6 +2966,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); @@ -3211,6 +3232,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;