From patchwork Wed Oct 26 22:54:34 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: 9398597 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 9558D60477 for ; Wed, 26 Oct 2016 22:55:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C95529E27 for ; Wed, 26 Oct 2016 22:55:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5168729E2C; Wed, 26 Oct 2016 22:55:00 +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=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 A1DAE29E28 for ; Wed, 26 Oct 2016 22:54:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932821AbcJZWyn (ORCPT ); Wed, 26 Oct 2016 18:54:43 -0400 Received: from mail-by2nam01on0072.outbound.protection.outlook.com ([104.47.34.72]:12896 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933885AbcJZWyj (ORCPT ); Wed, 26 Oct 2016 18:54:39 -0400 X-Greylist: delayed 84943 seconds by postgrey-1.27 at vger.kernel.org; Wed, 26 Oct 2016 18:54:38 EDT 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=eo4PRcDHbzWstAKk1ivcO3de5OgtFBd6/Lo4uLQZOAo=; b=Z1K1VjiP5cEef9R8yPVfvMEd43UL49sIr1u+p54eL73RuauEaVmjVnb5a74nu3wLbBb211hJpKhP3dRJB7uGKtgixmJdtvoI9Hj9F9Gg6N4N7Ql8DqROB3EnrMHn5bqFINy4M6lq5rHj0REvZad8aDVurEVbBnyBmH0cpksCG4U= Received: from BN1PR02CA0013.namprd02.prod.outlook.com (10.141.56.13) by CY1PR0201MB1580.namprd02.prod.outlook.com (10.163.140.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.16; Wed, 26 Oct 2016 22:54:36 +0000 Received: from BY2FFO11FD027.protection.gbl (2a01:111:f400:7c0c::128) by BN1PR02CA0013.outlook.office365.com (2a01:111:e400:2a::13) 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; Wed, 26 Oct 2016 22:54:36 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.225) 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.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 BY2FFO11FD027.mail.protection.outlook.com (10.1.15.216) 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; Wed, 26 Oct 2016 22:54:35 +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 C7.BC.61581.BD131185; Wed, 26 Oct 2016 15:44:43 -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.319.2; Wed, 26 Oct 2016 15:54:34 -0700 X-AuditID: 0ac94371-607ff7000000f08d-13-581131db0599 Received: from exp-402881.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 1A.FD.02564.A2431185; Wed, 26 Oct 2016 15:54:34 -0700 (PDT) Subject: [PATCH 08/12] 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 , Ming Lei , 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: <28b3e91c-018a-0dbd-8ca9-0a7994a97a5d@sandisk.com> Date: Wed, 26 Oct 2016 15:54:34 -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: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrIIsWRmVeSWpSXmKPExsXCddJ5ke5tQ8EIg9X3bSz+7znGZvHy/AdW i5WrjzJZrJqYZ3Hv6Bcmi723tC3mL3vKbvHsUC+LRff1HWwW5z+8YrJYfvwfk0Xbxq+MFu9/ XGd34PWY2PyO3WPnrLvsHov3vGTyeHBoM4vH5iX1HrtvNrB5fHx6i8Xj/b6rbB6fN8kFcEZx 2aSk5mSWpRbp2yVwZby9uIml4KJERdePZpYGxvmiXYycHBICJhLbjr1m6mLk4hASWMokseFz HyuEs4NR4vH206wwVQ+vHYKqWswocWNOJxtIQlggUuLzlbuMILaIgKzE992vweJCAnYSP8+s ZwdpYBbYwyLx78FSFpAEm4CRxLf3M8FsXqCi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zld/Xmx9/vvVRdVzbqdyfQ1j3rm00FH1bl3K9Hvfl1rWv168aZvVNwsFh/ticWpVDpq8d/sW li0qZVXUOn5PrctZ0Kbygomg2GHW82xrNxRPqog4ZOfx6uM9M7GoSa5KLMUZiYZazEXFiQDo sOc0OwIAAA== X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.225; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(438002)(199003)(189002)(586003)(77096005)(19580395003)(65806001)(8936002)(5660300001)(65956001)(110136003)(19580405001)(65826007)(626004)(6916009)(2270400002)(50986999)(11100500001)(76176999)(31696002)(2950100002)(86362001)(4326007)(69596002)(2906002)(68736007)(54356999)(356003)(87936001)(229853001)(97736004)(23676002)(83506001)(8676002)(92566002)(7846002)(106466001)(36756003)(50466002)(53416004)(7416002)(47776003)(33646002)(230700001)(64126003)(189998001)(4001350100001)(31686004)(305945005)(81166006)(81156014); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0201MB1580; H:milsmgep14.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD027; 1:lEM9o4z5bNzJ994LNdk5Xy+m/qzqKL1RNyybkYK/jsuvETo15LP/0Gqx2no80NHzl98vLC6pnPjU9PSBlnn5n+Apx3WZlyZZ3Tu0VQKjafSWtVPB/tMVfIjj10a4VTmeNVH6zKx0fEujSaJKVOtai5eAVUiNHjqIloGDyJcs4PrTexJqUo1VWt+H9Q8Bej/rXEoGsFQFApGAy3ceo5PQpyG2OCq+bT7K16QA6n9Lx2aHT6vnTjww37d9MV/yhUcDf3fmS8uyO1LwU6r4oaZu6AfbPTfEBOCzaWCeS6ZVpdJhJxHkfR2L7a/uu2Kp+6LioqRdFuzlpte2W1BHUnyIYmfiUOS+WNnAfxErSL/qO1G/FzMoLb3v3Zm9yFx3W3ERIc4UYUM3QdSqgBULLQ2tmNo/EtAXJvzoup0mnPY3vVtcHoWtcQJPW2JY6OY59MeCrNSlrNmI1m2yaMmWfGk3m4Trr/nSzgF49WfTxZ7d7YZuNCQSj+JLLtWQd2TXZRvUlDp7B8Ic2vBHY9sX+t1kaDErUZvJZ2Rg0qhALmnlCasqRCKQLOL6dbrX3gpjoSCs X-MS-Office365-Filtering-Correlation-Id: b3edcc82-5b0e-471b-2b10-08d3fdf30eac X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB1580; 2:u9qyNcTUXANyDsevJIcXWsc9tk6AaBDbR3PlU6Z+R5JwA/YftYuE/AGyrtUCpljhwTgpd0oBm+M2uEop3Svadow/3TXtt/7PKyUaL4bKYqmcwHXuQ0rfY3VqYS1WWtaZw9BBHg7VUVJC3B7+y17wfsz8cp7wkHOQBTK8jmHM2NlLxHhaVPnzlpUXVDY675u5rSIdZcFJxGR1K+eDljqkfA==; 3:brmq1InZUrcif1mWmcbg/cryDmhsMXv4KUBENo8c3ajUOoK56HcaLDse9ukqZg/PTUmwdhRXtKopCHrZIbVTTcsStdlLtnZ1EMRjLAXX4SiS4ncqvhHjsB4Vz17YxmMAJAFnbCVZ/eQYYhZde8i12w+UhWzOqC5HhmuK/zhQJnwAd+cYKpXuoATscmsQN6bstEvyzRnvUEdL1G9Jct8WXkh2YTampnBNtIfjyW4FZoVl3ThAz2ptkcRV2biTLcn4X/peCyXqJpK/y31CZTeWXzi+EgPBAZolO5pZgleadEw= X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:CY1PR0201MB1580; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB1580; 25:24NMDVfLiukkff3yO1NzcT5SRsOAoily6pC0AgtRyMa8T9xN+0mh05IP9F6NeOGaAd9ILr0XhwqEAqdEaZcr9FswIPjW0ANDDQTtbNglRWpBwVdHuLCmNWO0C6pNAUl69OPV3DNklE7v5Ed2DHvccgbn0ORy5w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KgKosldqp+oxBd+XHqdNZeTc9J2b/rSdRQe82MBQlnkddl3r4ULksduvBBgbhGUBvwlMjC22F0P1F8rKyR9mGXo7m47MN2S/2zgEzeMWQ4GRn65DHYHXE9t9MzhkSoETHM8ycQFyVdtiI1eFHrvYyySq8ROp3NXeDpR3mO6DhFdekrGTxvmK0u7cmBimkOXxbjeIrjrJUAsUPIwqYxsuTSbt9m9khPjs0+w5OkVm2JAYrJ5vcUPTp9JAzhxmRRxt6QhkfwhUa7nscSoHX+aYVWcSDTJi2SQsxqyemUYYDhGNxVUvuDGNIeiVnxDXdvBAqra3TLbbvQeymsLpYAfwRmIULrPhIIk6CjpYpCGejvnTcR8Topvqq3Qt5UNRyw4jJDxoAk9xwiNLa93MntHCcfEegyw7nVYLhDFtWsm5Sn6+rhO4 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)(5005006)(13016025)(13018025)(10201501046)(3002001)(6055026); SRVR:CY1PR0201MB1580; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0201MB1580; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB1580; 4:TEUWogeqvsdLQZhaf80TKKtKbA4iw8LngEP3EHtjQBjqgwZAaRn1IORIN7xCLNt0QXjVMwWa9oS28tsxpXiI5qhJ8oBoADH3I89ux0a5tFcGo3hn07zEJ72cy7PkiLv78HfORRbw+2Zpp0C09L+qL5D+JI0rBAL48mQ6+TD4rUuebjk2dphgOFeLo4EoFu6S3rNeOb13GAgBp1vaOhCCfYAv3MmSm+EueLpOL7GUv9bZMDXYz4AaC35EMPJ04CMYtpr0fahQBmddpknWdzXt/PsyNBlUYDugJ8UzCyMrTOnp2xU6MiFEM5kWgmZhV1x1qESorgZICIG2Mv51he4JA0HNnoH/Kbs0/p29hYkAsw/zF3DWGCp2nnu4j5G9n5s221JSwVbRt8k4WeCIq7FNvm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Y215VkZlVGZoeGVlZlYveDhmd00yeVFQNldwVGF0?= =?utf-8?B?UGp6RlZwTmZlOWV4ZXlBNGlTNGQ1eTFTQzY2clZLYVNZOGt3TlZXTnMyMlFY?= =?utf-8?B?c0pIZXg5ck00aWEzdi96cG5nPT0=?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB1580; 6:zhMU8VYJ63SfCFWtbKDB7SSTwuLCb/9ZEZKcmGiHcY3lG6dAow6+73jkilhT29H8LXIZTVV5oy0upoQk+VKVx+C4kJiXjLwLxL3MHFKFOltv4sXsdlK9Hoff1OQ36L8Kd2q6/0PxBwXooJmuzrCUyXTs2F2S7iJM5D2TqxIyaDKNuzSywaQ8XLI1CHggbov4LKrnFFR8kUXogD5d6GcMlVgDCGxAAdd9ks7wPrchZzkPb2bHEfT5CRSWRozHHMJvZ2AOOdKrAaLvjgbR9fo4/tIzLKIQ6ueXnNP5+Cz5MhiZ5JUHz2RyVht/Sytv4JI3ozEgb6j2tQF0YvG8aHSmNP2kKhtVo278zaXtner6Hj4=; 5:FGnRnfN5wTk2VxY39vDDRidpZitQ1DBwyrUbLAD5LYTy0pVT95XM2PtH8pu/KQyDOs27H00Nw+EBZKIxK2R5tvmDpv7+cKLQXplgD5C+XBvCHLSdd2Vv/iMnButizKWtI25T1HdSVDUegNYVSgJ/vg==; 24:fEjuvpXYj8UlVx5gqudxxLfQcmTFak6uFGIkCnYIlaIeiScUFxu2OwZ/Wbo/MfaGLh7uGS5xHV5ZORBAY1OshnUjwlAva85hQ0BY464NyIo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB1580; 7:zB1+JgN7HsuJG4O1JACu9LJxAOPfejMBw1dxMhOBtBVgPC5Ifkr/Jl7c7luKbOiVzsZWSMCizz59rudQrV3KhlABt8+js56JV0sVhkOTAvRWafikIDvKaUpp8v1E7uzYL1A+ecdyzivVbCKLCFvz+HuFb/wK1kDg9oy05KuWtmrpC1pShi/u24aaRC0nSnGoVFtEJSOFngonSDjHsD4EYmjilLtiY0DkK0c7HpSiOGH3oL05m7Zx+tYpRe40yXm2DrUGhScsg/W3JMrG23EaOvC3WJZbjWYtPY0qTw0+/rGpTNdtk9lcmrbWQzETQ7G5k/TDndvcRYYlrDZgQePVhcpYb7/9+aSm6DYOaXjw8YM=; 20:GzIfcK0L4xMTU2liWquAl7C6Plb8xAfo07CeotEyVPcASQ79yjV7GnSRdLCegSXZQV4vIKY9TXQiN7BTBWHy+uteFGVLeFyN2YIlwsgE93gWFGxhyDeKVyQfJxEplh+bWaL7jUUGsaj8Ek0+nt1qzSf+eqJHRYto/VdM1uVicdPW/iREbEvv/EFsvt2GzwcxQqpNW+hUjaB47aE5iXKegels0yvLaOUkEk9TfMV19wFyK3SpVF2hJx81yLahdQKU X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Oct 2016 22:54:35.3168 (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.225]; Helo=[milsmgep14.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0201MB1580 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@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 Reviewed-by: Hannes Reinecke Reviewed-by: Johannes Thumshirn Reviewed-by: Christoph Hellwig Cc: Mike Snitzer Acked-by: Mike Snitzer --- drivers/md/dm-rq.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c index d47a504..107ed19 100644 --- a/drivers/md/dm-rq.c +++ b/drivers/md/dm-rq.c @@ -105,6 +105,8 @@ static void dm_mq_stop_queue(struct request_queue *q) /* Avoid that requeuing could restart the queue. */ blk_mq_cancel_requeue_work(q); blk_mq_stop_hw_queues(q); + /* Wait until dm_mq_queue_rq() has finished. */ + blk_mq_quiesce_queue(q); } void dm_stop_queue(struct request_queue *q) @@ -887,17 +889,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;