From patchwork Thu Sep 29 00:00:54 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: 9355397 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 1492C6086A for ; Thu, 29 Sep 2016 00:01:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 034482969B for ; Thu, 29 Sep 2016 00:01:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB216296BD; Thu, 29 Sep 2016 00:01:09 +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 7DBF5296A3 for ; Thu, 29 Sep 2016 00:01:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754473AbcI2ABH (ORCPT ); Wed, 28 Sep 2016 20:01:07 -0400 Received: from mail-bn3nam01on0066.outbound.protection.outlook.com ([104.47.33.66]:13280 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753938AbcI2ABE (ORCPT ); Wed, 28 Sep 2016 20:01:04 -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=+1p6US0tk/UbfV75xo5X6+NDtxyhxJul7CqqeSaeZtE=; b=LjK9Hlt8NUW4TN8BNvhNGGO1YsQsaqA1NYmleCoCzsjKwbL2YWSrJBSZp8vLI0kK+uV/W6Bkamaa++EiaHvJdHHkEx8vw70PqJCagytPiirx3ZuOAutHDfsrcnEcbndOrEJhumY6ZVaJ/N6vo/96l2xi53s7jIfY9YbUqpANn7o= Received: from CY4PR02CA0044.namprd02.prod.outlook.com (10.175.57.158) by BL2PR02MB2130.namprd02.prod.outlook.com (10.167.97.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.639.5; Thu, 29 Sep 2016 00:01:00 +0000 Received: from BN1BFFO11FD017.protection.gbl (2a01:111:f400:7c10::1:114) by CY4PR02CA0044.outlook.office365.com (2603:10b6:903:117::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.639.5 via Frontend Transport; Thu, 29 Sep 2016 00:01:00 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; 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 BN1BFFO11FD017.mail.protection.outlook.com (10.58.144.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.629.5 via Frontend Transport; Thu, 29 Sep 2016 00:00:58 +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 2E.C7.26959.5675CE75; Wed, 28 Sep 2016 16:51:01 -0700 (PDT) Received: from milsmgip11.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.301.0; Wed, 28 Sep 2016 17:00:56 -0700 X-AuditID: 0ac94369-ef8199800001694f-f8-57ec5765132b Received: from exp-402881.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 7F.94.02783.7B95CE75; Wed, 28 Sep 2016 17:00:56 -0700 (PDT) Subject: [PATCH v2 5/7] dm: Fix a race condition related to stopping and starting queues To: Jens Axboe References: CC: Christoph Hellwig , James Bottomley , "Martin K. Petersen" , Mike Snitzer , Doug Ledford , Keith Busch , "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: <8fcd8dd3-567f-a6d6-0ea8-f8cd510aea6e@sandisk.com> Date: Wed, 28 Sep 2016 17:00:54 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrAIsWRmVeSWpSXmKPExsXCddJ5kW5q+Jtwg7UHjS3+7znGZvHy/AdW i5WrjzJZrJqYZ3Hv6Bcmi723tC3mL3vKbvHsUC+LRff1HWwWy4//Y7Jo2/iV0YHbY2LzO3aP xXteMnk8OLSZxWPzknqP3Tcb2Dw+Pr3F4vF+31U2j8+b5AI4orhsUlJzMstSi/TtErgy7j/a ylowUbJid8dDpgbGk6JdjJwcEgImEmdurGXtYuTiEBJYyiQx/+seJghnB6PEkxer2WGqWk8t YYOqYpS40twAlODgEBaIknj6gxekRkRAVuL77tdsILaQgJ3EtPnNjCD1zAIfmCXe9h4FS7AJ GEl8ez+TBcTmBSr6fagNbAGLgKrE/D09YDWiAhEStx52QNUISpyc+YQFZBengL3E9acaICaz gKbE+l36IBXMAvIS29/OYQZZJSHwk1X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Nu6hrl895RevVtgV367SOXdmmk/lFiKMxINtZiLihMBXt8GBSoCAAA= 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)(2270400002)(92566002)(8936002)(50986999)(76176999)(54356999)(68736007)(2906002)(230700001)(36756003)(7846002)(23676002)(356003)(305945005)(586003)(53416004)(31686004)(106466001)(81156014)(81166006)(33646002)(229853001)(8676002)(4326007)(626004)(19580405001)(19580395003)(64126003)(7416002)(47776003)(69596002)(5660300001)(83506001)(87936001)(11100500001)(65956001)(65806001)(50466002)(86362001)(65826007)(97736004)(4001350100001)(31696002)(189998001)(110136003)(77096005)(6916009)(2950100002); DIR:OUT; SFP:1101; SCL:1; SRVR:BL2PR02MB2130; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD017; 1:kO4OcbuXJv8e9215mvZBN4ES4OzdFeb2Q7R3w48w+uTti9YdTuV/ZK/jWpOODl4nSOr8GydIapmK6kO2ey0agG55voMv/qkWb6lpi3Pz1mHAMafoZ9ro38xifsOdgj0bXQUJ06bGXBna2Fv1f7Yxxqmao0vA4pi2SlJxqpP9urKFFf2pWp4jEeHowhQSNY+Uwvm/cZPuboLvsiR1Lp7WoiycPSB0UXKOGHid2FP0Tqqz5xCME3NEghkFy4iiCewPAVp9MyOHAiOVMBCUYPl9z7nFJGvareWJr+q7+vFXu2tbdnfhNTVV1wliwC16XYRDA2WB+mlSed1YTj+SvTFPORfEbnQI0+yqck0kK+fEwttOqyGbBGgM0X4zKoTWqXA3QzFzzelanqX6jj7UCLRVX9yX0eeKAte0AxxifVL57Hn4a3wE8xHKrouq3zXPH1wOlkNBdgG2xe0EhzMpAliRe1nO40CV9A7zKeK2ofwSmXvGEsErw6EKu188DX+48G05f5yhhBtWoRKLFKxmJg7LmtsJFUzkGr4lIVHrREQ8PDYmvt6+kD2fRSlBK8DlcD5Q X-MS-Office365-Filtering-Correlation-Id: b91b2161-b4a7-47b6-ad15-08d3e7fbb1b2 X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB2130; 2:m/H+fkkMvBF844evMTSBfogIAh6ojK+IZpiQPQGowP9r5eRHxWK2ewIID9YRpdFge9RX/cn7DbcIYji1hSGBx1vCvGDcjX9b2flYfrYdD6f88WpezssyJXNeMe1S8ZHPAMgMr6S5iw2rgHO71/Hb3j95R3B72vX8NLCn1AQBacPslt/nNkdaWvdN2qqkhDX9; 3:X5xokabG3GzRUKg0ZVkTfsP4YiKg6KPXFeOmFxTzDuZmUyRmn1tifjH53w6r9zkV1Zx9if2WdkTfHQodP0WUsM/iVlLoyM0yhghev+zf+Ln7j+lJOLM6GBSSUNKUMQJT4u8+Mw4/YN1znUBYZ2EXY5F8Mw/S70zmQxTY69NDiIlhIZe3a/UwozV88Lv9nF0zyHthdg7MEoETpIfLLeq5S1qPYoObvgKxk76r59/etDJmWU222/oUE9Rk/a8jLkTUFmHk7Pnrrb6WblF1Jhkpew== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:BL2PR02MB2130; X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB2130; 25:bFm2vxUyZRiqtV2hurTp+lNSPZo1hnjMB3xt+wy15r83+it0qY91NTc/2lNGqMFdBWT4MNhWWQOBAuDWajH3625psMZDTeYAv8PfYHgEg/4HR03WlajjpA0zVrfNdRacDGtD4UjaWTOEBqv8aH/nf9eZ3aZpoAoy4bsOUm4mTQF1w4qA1YzE49hkKRWQl1dFm68Yby1QPNW/YobDy+oV+BgHqBEXZKBM7tUdNB5Iohb5s7XtU1s/67Kv787wwCX+0sXkDUzTSM0zOSTfLi1bNUMxykA+70KmHm8jb74+AeJN7A7CoPou+Ytpt1JutUrQsubEcbTXN2bTl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vTpBkdT5iSMcQRT0wHCyIhphRpONlZzdbPSp0jNgI5eZbPOR1dZBo06jGZ7Fox3/XNAf91fl8QzN1AV5y2Y9UJGmRqmEu5aq0LhSRPjyZ1iaM0BmUH6JUS1gA/PQvBiqzgPk4QyHrdtDFz8ONTRmpzpkH01yz5HI1hpLr1KeeNDPz8FYAmx+/D1D6rk/Vkjij1zagAOLEhl 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)(13018025)(13016025)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:BL2PR02MB2130; BCL:0; PCL:0; RULEID:; SRVR:BL2PR02MB2130; X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB2130; 4:mp/vq/iHLCFtJQRvxGcf4qPnolewHK7LP8EAYs4SwoMl5Nd9vV67N2qCL71NBamO94qamHCjnTMyfD/xXwlN5uJxdkSM7I/KX8AS5ArVW/Jx7TVjhsRQ6x5wwkngNfb4AhfyiTELaYCYblrDcJO/RRbd/CHPbTmaNzWn1eY6ZGqF4+AwmbN7v/1Sc+g1V8SWMWW/PRr5bJz8PMUUqs6Z3ZQOpgMdxOFScIWK/XbjV6kZuPhd4TQ3S7rKW4IvK2msM7ma4VS6i5X9dv6zkd+i04yh+YFp9sSWA4I4wW1rqtkr5GFNuxRNXbv30gu+a517kpyUXqQgIGRTF8jRNoFusJvR8CMt6+Li0WssJjsi8CrEAAJlyKUrdg9VipPyATzKfsjiwrHjrk3OXbZtHtrg2fd55jstFzNuKoJEDqwNqyja0UfTRlUIP00DACpdKxJsw09Yyvi3FLBMn8F8/zVYbOBcxZJvu9d8T3aqE0KkpHU= X-Forefront-PRVS: 00808B16F3 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTDJQUjAyTUIyMTMwOzIzOmNsYjQvenNxaFdmSGFFTVZtV0tkNjMxejFV?= =?utf-8?B?TVNVUj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L37u1E3VWrdB3OnkB0Fkh9mqxJZAwY3SfRIGkIie2TYSRz0kl4rnw5lxCkdZoRZsC80KNsJpfQgi+Riqt97SjedcVz+4PEs4evCrwLBSsRunbY2575+nkB8kwDNT1BeyYp8AxEzn4p X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2016 00:00:58.3784 (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: BL2PR02MB2130 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. Not tainted 4.7.0-dbg+ #1 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 Reviewed-by: Hannes Reinecke Reviewed-by: Johannes Thumshirn Cc: Mike Snitzer --- drivers/md/dm-rq.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c index f2c271a..f7a8ba3 100644 --- a/drivers/md/dm-rq.c +++ b/drivers/md/dm-rq.c @@ -102,9 +102,12 @@ static void dm_mq_stop_queue(struct request_queue *q) if (blk_mq_queue_stopped(q)) return; + /* Wait until dm_mq_queue_rq() has finished. */ + blk_mq_quiesce_queue(q); /* Avoid that requeuing could restart the queue. */ blk_mq_cancel_requeue_work(q); blk_mq_stop_hw_queues(q); + blk_mq_resume_queue(q); } void dm_stop_queue(struct request_queue *q) @@ -887,17 +890,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;