From patchwork Sat Oct 29 00:22:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9402935 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 A9009605EE for ; Sat, 29 Oct 2016 00:22:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97A862A8A8 for ; Sat, 29 Oct 2016 00:22:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8BFBD2A8BB; Sat, 29 Oct 2016 00:22:31 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable 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 2865E2A8A8 for ; Sat, 29 Oct 2016 00:22:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965314AbcJ2AW3 (ORCPT ); Fri, 28 Oct 2016 20:22:29 -0400 Received: from mail-sn1nam02on0061.outbound.protection.outlook.com ([104.47.36.61]:51712 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S964933AbcJ2AW0 (ORCPT ); Fri, 28 Oct 2016 20:22:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sandiskcorp.onmicrosoft.com; s=selector1-sandisk-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=QWBpekPdJOMKAUAsDqq7FvAM5HgJhnj5Uu6lK6WFfCs=; b=FoKkgqdQc779Ram8J+ifnPdF24vZY0ZsgMNW3RPxg9WwYR63TAjUhKoealRHiqafs8wUUMuF15ohg877wVdWdcTDsZAaxFYqIXjuCzjjNrhabQJDEboX9gEBh4lMCPh+Cc288BsJP3mQalnrX73B0fbJdWe60mlCizfk4gZ7qNA= Received: from BLUPR0201CA0035.namprd02.prod.outlook.com (10.163.116.45) by SN1PR0201MB1584.namprd02.prod.outlook.com (10.163.130.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.12; Sat, 29 Oct 2016 00:22:18 +0000 Received: from BY2FFO11FD045.protection.gbl (2a01:111:f400:7c0c::149) by BLUPR0201CA0035.outlook.office365.com (2a01:111:e400:52e7::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.12 via Frontend Transport; Sat, 29 Oct 2016 00:22:18 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; oracle.com; dkim=none (message not signed) header.d=none;oracle.com; 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 BY2FFO11FD045.mail.protection.outlook.com (10.1.15.177) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.5 via Frontend Transport; Sat, 29 Oct 2016 00:22:17 +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 E2.3F.26959.129E3185; Fri, 28 Oct 2016 17:11:14 -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; Fri, 28 Oct 2016 17:22:16 -0700 X-AuditID: 0ac94369-babff7000001694f-3c-5813e921eed2 Received: from exp-402881.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 16.4B.03615.8BBE3185; Fri, 28 Oct 2016 17:22:16 -0700 (PDT) Subject: [PATCH v5 10/14] dm: Fix a race condition related to stopping and starting queues To: Jens Axboe References: <7460e8b2-2cfd-c0d5-7ae7-7f662d89dad3@sandisk.com> CC: Christoph Hellwig , James Bottomley , "Martin K. Petersen" , Mike Snitzer , Doug Ledford , Keith Busch , Ming Lei , "Konrad Rzeszutek Wilk" , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , Laurence Oberman , "linux-block@vger.kernel.org" , "linux-scsi@vger.kernel.org" , "linux-rdma@vger.kernel.org" , "linux-nvme@lists.infradead.org" From: Bart Van Assche Message-ID: <740b6120-f11b-c5f5-8072-af16ff1ffe5c@sandisk.com> Date: Fri, 28 Oct 2016 17:22:16 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <7460e8b2-2cfd-c0d5-7ae7-7f662d89dad3@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLIsWRmVeSWpSXmKPExsXCddJ5ka7SS+EIgykzmC3+7znGZvHy/AdW i5WrjzJZrJqYZ3Hv6Bcmi2WLnzJa7L2lbTF/2VN2i2eHelksuq/vYLM4/+EVk8Xy4/+YLGac X8xq0bbxK6PF+x/X2R34PV5PnsDoMbH5HbvHzll32T0W73nJ5PHg0GYWj81L6j1232xg8/j4 9BaLx/t9V9k8Pm+SC+CK4rJJSc3JLEst0rdL4Mpo2/CIseCneMX0ZU2MDYxXRLoYOTkkBEwk XsxexNTFyMUhJLCUSW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uoSf+ZdgrLlJba/ncM8gZFvFpKWWUjKZiEpW8DIvIpRLDczpzg3PbPA0Eiv ODEvJbM4Wy85P3cTIzhmOKN2MF6faH6IkYmDU6qBcdb/u+vK4jabVxrN5LMxc7KUfZp68OD1 Tawnvjxv0nd0PuZwPWef/rdb5gsOeax/Javgs4Xfn1v0Ru5srSca7HMKVf7UZy79YB24exar QGvfSV22h1cq5/3nTVO/v/xs75NpU99mTA7+yany2WH2soMTfL28n8vtvjM3RGaLufGrKR2r a+eeylZiKc5INNRiLipOBAA/aIdmSQIAAA== 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:(10009020)(6009001)(7916002)(2980300002)(438002)(189002)(199003)(11100500001)(19580395003)(23676002)(8936002)(586003)(6916009)(110136003)(53416004)(31686004)(2950100002)(65826007)(4001350100001)(189998001)(626004)(4326007)(36756003)(7416002)(5660300001)(69596002)(97736004)(2906002)(33646002)(81156014)(64126003)(54356999)(50466002)(68736007)(8666005)(8676002)(81166006)(356003)(83506001)(76176999)(87936001)(7846002)(305945005)(230700001)(50986999)(92566002)(31696002)(47776003)(106466001)(77096005)(86362001)(19580405001)(65956001)(65806001)(229853001)(2270400002)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR0201MB1584; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD045; 1:Ax56AD6nXPFwJ25yFVvkKi5OlbzuVMutPqxHoo/KBTh54PpAxYQrQoR3One3VNkY2vsLhS09AADFoP8szn6/7mLK6+XpnTefStB/o6DA9cc+dnxD7DEkiyxtOUibs+2WTMWAVIVSpcL6hCWuQ8s9opdUs0SPtJhXz31HRE/h1ILwdlPLN6eAG9lwM1T6DwE5jEyhDSYCk0zZMdlWldBKDABDVSDVP6NwfHPmXlrnXH8QOakxDESYaADJ1yF1Xr0vyLCsa7aS82gMqNzZXLZ+C1e0mYqv8gqzOxn5fH5QQPL63uhygRk4/1oI462lrLAJ0uRZHOV62v8LBNJs00vFNfU9U9rONer6h51gaC0pWUEYkN+dIcnZj07j+UwbOp+qJ6w8fc5oRUgYqh17cZl3DN9JkGQKsnB8dIv+32q0T6aAYWE+ZWjPrjJKlf63o9BBS6OCgmGiO4YM5jZS/KFEuRA3GQOBMjLK++/IucjqL5Jnovh/081Xll82q6BuYUwWN4dAMWTwkFZVrNzyTq9rnYHlkmULfSeIq/8RTyIPcOkOWDowNO259GMippU0fP3w X-MS-Office365-Filtering-Correlation-Id: 49ea2395-53ff-4685-504c-08d3ff91a43c X-Microsoft-Exchange-Diagnostics: 1; SN1PR0201MB1584; 2:UybOS630kSPVyx/IwmV59bgyPtLP8ZHpyA2sFzOTqd/5N60I9kR/4PFG9nhVnT9S70uoscozTBxbJREdWoGEalUGImXr2HeXvlKICKjna5FSIrIDR5JnzhYmK9v6yvXSIPv4ve4WqROef2go5WMgt48k8wQRPpkxoajiqVZggCrwvh5oBSrTm2le1kjsrYSe/Ih3JoBzBBb6NvMld2bd4w==; 3:c8+wRtXDB+NG27gNgRXxnPHN0to0jF3J/laEJqqubaO0mVztIkYbagmK8kXO6/8wkqjKSDDvF7iiyaBrZX4rw9HBnAlVgyV1RGNIVI5v1Bq2wnpiUoZ7hJ5Lqy2xwZ6D+95jOJzFY66Y5huE1ZoWcs1YjMHscEzaf2o5QHqlSrzjhOWBFXGPOLZc28e1uwPZWTlEEBZX6DmnshVT0ZmD7JLioVKyS37v90NS6xyrqWACMDF6PxfqYSlNkow4b6naB+kPpeT475YrvOyd/3Dfjdf4CXR0ENdp83eUsBPb+nc=; 25:IxViup+jsWoHJDM85wdxgsS+EkYTcNkp4T9SMo35QgOCzZ7tr01RZKvPQ6yVltOoRYHmQlt0pU+PKn3IfznBFa95EIEN8umuP0c9slxmkm5gXU81rMmVpZ467pzCcR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YLncXGEAo65agMpItiWnkjFb0+xlvDy0BswwyZhCaMcMLMi1kgE3i73ZaX541yCKm06cDppkADk/p8EAfjSEXgOHZKGH9eRJ5CFNAqiQ66crOafXlW1yxAen0IKSTrFHYwOkPEoXBz3R8 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(13016025)(13018025)(5005006)(3002001)(10201501046)(6055026); SRVR:SN1PR0201MB1584; BCL:0; PCL:0; RULEID:; SRVR:SN1PR0201MB1584; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0201MB1584; 4:btADBrl4mfNz8cc9Vm1kTie7Nx+bFxhs2ApcyhVPElCLzs7xvaodbYq7bwzDnNZ2sM++gW2rtGJeSU97Ygo3nQfwdtxgy/VA8ZhGkE9VcfXKZEPXZFiSLW/Hxi1nCPlsyMfjcfc46bgHftNviBWFK39wKfG6HYvjnNhGkPZh+cIoOmGqblwtir/XwiBVwm/kC8QfN9ELt+3CFn2q/srcMdwHCQRGG8TASHaZT4LCqEv2v8E/aWTysQTDK4wqo7q19XLHodSL2b3SdRY4C1H3cqMsD8yDzjFUUc2/bH7h0vQqxRgUdm2MlhLUtjugZK/r/3r8FwDGK/NjPX8doPOriN1JxS7V+znTu3VNvLtb7JcJcQxF7aaCzQcPi8ZWvWAE0SUDevNtV9QSkzdGAPZ9FKU5TrB5qqAimD24TjzkroDyxznQJJiuif67P5FGzJueOG/J19XGAyVDynBqU8KIiXkchdLUl8++u5ffRfHsfVY1y3IQWJguCjzvjLVTzziy X-Forefront-PRVS: 01106E96F6 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtTTjFQUjAyMDFNQjE1ODQ7MjM6TTAzcHgxU0x4MG9WYTRqbTFadkkwTk5j?= =?utf-8?B?VjUwRnVJT2hEVVlaK1pyLytJZWxuSjhyUzF5UTNqOGJZVEdBN3VBckw5OW0w?= =?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X/XbU7cQFEbewv4ZOOZlXPIs3zWUbZwYvY6NFzspeW5uoL3oaVFdR7OR3H2CZHCtPzzU6uwoRr0FAlEAfpd8COJGOgl2zKdnz+e1HQOLp9pRWTCk6FDEWstz1hwIP9C42EpIRt1BgHRNzVTFNzU2imZqQwo8hdSteaVjyHOnan2y79EHhCAR X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2016 00:22:17.8412 (UTC) X-MS-Exchange-CrossTenant-Id: fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d; Ip=[63.163.107.21]; Helo=[milsmgep15.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR0201MB1584 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 Ensure that all ongoing dm_mq_queue_rq() and dm_mq_requeue_request() calls have stopped before setting the "queue stopped" flag. This allows to remove the "queue stopped" test from dm_mq_queue_rq() and dm_mq_requeue_request(). This patch fixes a race condition because dm_mq_queue_rq() is called without holding the queue lock and hence BLK_MQ_S_STOPPED can be set at any time while dm_mq_queue_rq() is in progress. This patch prevents that the following hang occurs sporadically when using dm-mq: INFO: task systemd-udevd:10111 blocked for more than 480 seconds. Call Trace: [] schedule+0x37/0x90 [] schedule_timeout+0x27f/0x470 [] io_schedule_timeout+0x9f/0x110 [] bit_wait_io+0x16/0x60 [] __wait_on_bit_lock+0x49/0xa0 [] __lock_page+0xb9/0xc0 [] truncate_inode_pages_range+0x3e0/0x760 [] truncate_inode_pages+0x10/0x20 [] kill_bdev+0x30/0x40 [] __blkdev_put+0x71/0x360 [] blkdev_put+0x49/0x170 [] blkdev_close+0x20/0x30 [] __fput+0xe8/0x1f0 [] ____fput+0x9/0x10 [] task_work_run+0x83/0xb0 [] do_exit+0x3ee/0xc40 [] do_group_exit+0x4b/0xc0 [] get_signal+0x2ca/0x940 [] do_signal+0x23/0x660 [] exit_to_usermode_loop+0x73/0xb0 [] syscall_return_slowpath+0xb0/0xc0 [] entry_SYSCALL_64_fastpath+0xa6/0xa8 Signed-off-by: Bart Van Assche Acked-by: Mike Snitzer Reviewed-by: Hannes Reinecke Reviewed-by: Johannes Thumshirn Reviewed-by: Christoph Hellwig --- drivers/md/dm-rq.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c index 0103031..f9f37ad 100644 --- a/drivers/md/dm-rq.c +++ b/drivers/md/dm-rq.c @@ -102,7 +102,7 @@ static void dm_mq_stop_queue(struct request_queue *q) if (blk_mq_queue_stopped(q)) return; - blk_mq_stop_hw_queues(q); + blk_mq_quiesce_queue(q); } void dm_stop_queue(struct request_queue *q) @@ -883,17 +883,6 @@ static int dm_mq_queue_rq(struct blk_mq_hw_ctx *hctx, dm_put_live_table(md, srcu_idx); } - /* - * On suspend dm_stop_queue() handles stopping the blk-mq - * request_queue BUT: even though the hw_queues are marked - * BLK_MQ_S_STOPPED at that point there is still a race that - * is allowing block/blk-mq.c to call ->queue_rq against a - * hctx that it really shouldn't. The following check guards - * against this rarity (albeit _not_ race-free). - */ - if (unlikely(test_bit(BLK_MQ_S_STOPPED, &hctx->state))) - return BLK_MQ_RQ_QUEUE_BUSY; - if (ti->type->busy && ti->type->busy(ti)) return BLK_MQ_RQ_QUEUE_BUSY;