From patchwork Mon Sep 26 18:26:50 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: 9351133 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 62A29607D6 for ; Mon, 26 Sep 2016 18:27:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5511D28805 for ; Mon, 26 Sep 2016 18:27:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4933428A06; Mon, 26 Sep 2016 18:27:04 +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 9D6B528805 for ; Mon, 26 Sep 2016 18:27:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162156AbcIZS1D (ORCPT ); Mon, 26 Sep 2016 14:27:03 -0400 Received: from mail-co1nam03on0086.outbound.protection.outlook.com ([104.47.40.86]:62054 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S941512AbcIZS1A (ORCPT ); Mon, 26 Sep 2016 14:27:00 -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=ftVtu+Vud+iuwLDCk6GquXXVtD+5FpAzhtQmeYlISag=; b=AQ6yZzPI59LpM6cMyRRKcwMWSt69nB/GMlJA0l+MV6QEimvYGZuOZtGmjuyUtWAIOSZ4cF+iMf0YQHU89TIegfhVsZkoRQlenqALMsU2pkwpPQL9ih3dNUq+AKw7M69jELgD5mPJgfFfuSzGTRHHA6T7WT7ohdhr7dGuAqkB22s= Received: from BY2PR02CA0013.namprd02.prod.outlook.com (10.242.32.13) by BN6PR02MB2737.namprd02.prod.outlook.com (10.175.95.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.629.8; Mon, 26 Sep 2016 18:26:57 +0000 Received: from BN1AFFO11FD023.protection.gbl (2a01:111:f400:7c10::161) by BY2PR02CA0013.outlook.office365.com (2a01:111:e400:2c2a::13) 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; Mon, 26 Sep 2016 18:26:57 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; redhat.com; dkim=none (message not signed) header.d=none;redhat.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 BN1AFFO11FD023.mail.protection.outlook.com (10.58.52.83) 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; Mon, 26 Sep 2016 18:26:51 +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 70.C8.26959.B1669E75; Mon, 26 Sep 2016 11:17:00 -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; Mon, 26 Sep 2016 11:26:50 -0700 X-AuditID: 0ac94369-babff7000001694f-4e-57e9661b4e01 Received: from exp-402881.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 44.DC.02783.B6869E75; Mon, 26 Sep 2016 11:26:51 -0700 (PDT) Subject: [PATCH 2/9] dm: Fix a race condition related to stopping and starting queues To: Jens Axboe References: <7948dbb8-6333-dc62-2673-4da35b4dfdbc@sandisk.com> 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: Date: Mon, 26 Sep 2016 11:26:50 -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: <7948dbb8-6333-dc62-2673-4da35b4dfdbc@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrIIsWRmVeSWpSXmKPExsXCddJ5ka5M2stwg7YP3Bb/9xxjs3h5/gOr xcrVR5ksVk3Ms7h39AuTxd5b2hbzlz1lt3h2qJfFovv6DjaL5cf/MVm0bfzK6MDtMbH5HbvH 4j0vmTweHNrM4rF5Sb3H7psNbB4fn95i8Xi/7yqbx+dNcgEcUVw2Kak5mWWpRfp2CVwZ6/8s YC54yldxZOd7tgbGZTxdjJwcEgImEjNOH2LvYuTiEBJYyiTR0/eVBcLZwShxq+sDcxcjB1jV mtmhUEWMEk+3nWUF6RYWCJf4cPY2I4gtIiAr8X33azYQW0jATmLW7DY2kAZmgQ/MEm97j4Il 2ASMJL69n8kCYvMCFW2cM48JxGYRUJV4838OmC0qECFx62EHVI2gxMmZT8BsTgF7idd3f4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a5L3k6/M+cY2P8FG 0OullnDi9pJo7Z+XGKVz1iRv6Tqh7S20zECJpTgj0VCLuag4EQCVPb+WKwIAAA== 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)(199003)(189002)(106466001)(76176999)(31686004)(19580405001)(53416004)(54356999)(50986999)(305945005)(229853001)(7416002)(626004)(81166006)(19580395003)(33646002)(356003)(81156014)(5660300001)(8676002)(2906002)(68736007)(7846002)(92566002)(4326007)(8936002)(6916009)(2950100002)(77096005)(4001350100001)(586003)(65806001)(65956001)(65826007)(47776003)(23676002)(69596002)(11100500001)(230700001)(2270400002)(36756003)(31696002)(189998001)(86362001)(110136003)(64126003)(87936001)(50466002)(83506001)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR02MB2737; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD023; 1:777EtCJtbhEKSDfXrJZz5sphYAhuztbbUk2ghQcCVRHp8xuhLXXIfdclhwh1+njbLgR1AFNjaD7Wth5Ut3UBEVGbOBGr5Jg7IMUx5LlEYIeJoW0N/3uzGauDUYvDz7AqjLdp0N02GBNFUbP2oIJZyOoa3adNLDxkj7cYtfYOsKBdOlvC4F1UU3qwNgLrgFvZ6LTPtZXtebrsVu9dQHJ2Iv+dsONkK8uZmTcIwBPPfKBMS1E+2+icYXETRjN2SgNgogFQf1nhNiVECAWuzRTYS+3UFhMjf84SEsbGpPIWBrkHJilX0rxsC4cs9WqJFc52Q3WbDd9akCuEKWl0RsM7+5HwjO/+nP8EPkgrnhOW7XKR7U9J6eyWDI5MFs1NzNcoLu40fb5gekg7bqSObYvGuViHMcPuCSr/4bxkBHxC+eWZ2tUJ833EL7e/hzhErJLnHD3p4U/trsJs5lLF9YsJNdBlOMKAipWkfLIAyQkdq7PGu8lV+E/EsdFLHJskg1vyCi9UqlLKwATyLEP2vXE4vIjCuTQW8gtxCyuYIRdeveoHaqLtMfbKMdoxAyW91Cbt X-MS-Office365-Filtering-Correlation-Id: 37f33f2d-ea3f-455c-40eb-08d3e63ab279 X-Microsoft-Exchange-Diagnostics: 1; BN6PR02MB2737; 2:Phu0+KAZA0P0z2gqdXrP5+BJrnaWUaUJEbx1jDOulXJHoxsV8yoQRcyWJlX+EhRnRLkKecCf6fVO/V1QQ79rBafzXrzyDjOhzrV7uXrrsx+gg1KGS2f9ttk3OsnjPz0twXQyZbuD8lEBRdr0LRjyc1fW3fTy4dtlQzH2nLBPsBdo0UT76d0gBuVDFauUyYWI; 3:JubezkNCTWMLwxFfA3GndvPankzKb1e/otk9C5JUnosgywda8cEO8GsO2SqX/XBdj6AxpNCs1up925nIu8AJ3z3nq9jmXvMzu07XqdD9d/QbQd5v8JgaSqfg9E01CsWqcIi62Yc2hyaNKpplgP1s2cE2zvvKq4SnWyMvC8iUPKhfBllbPpX65HuGIboKRK24GMINb2eAqDRZdFrZl81mSr8Bx+a0TH78BEtikquLaH8M+sOBQQCjqZqtCJ32YOsvftefDymCz+64WHS8ghrxrQ== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:BN6PR02MB2737; X-Microsoft-Exchange-Diagnostics: 1; BN6PR02MB2737; 25:7OmCFbFUi1McWmrOxG6sXFwkOyb3HZu6Y68j/XB1MGFe1lGGI2hTlE7JnaFU+srUgHO8iHQZVM/1NOfdUawUtF6DTfnRXSko0x4k1V6QuvVuhp51PdKpmkXEfs0l8/15Mp0aGMPd4NHzQklDE4KH5G13FbDyczm4IBbSlLCPDCk1kSrkWMjtgQ0v00dPsH+oLRePCnz6ZKg/TuvCZzM/gt4028YA8IlQtt+giCu0oyQIBBXqOIKAHQrLwoujziyZ2PWG2Svv6GnKF6MjW43os2aTUrPoq9zu86N0t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JtKM8GFYOAGCZ/VFJpKKuDHVvxbkLqK8YjBxxtSaM9y08T98zQKovpv+oa9ijTRj8MmFBxoX7RihUeB9jFwnol9EI6J3BtLcTmSMJPpD69wzc5s1UkHh14r8dFCOKE4cFDLf7357jmitdZgAOLcTnMgYaP55ZzEvCqrZiW6siDyetiDGA0UD+csHCOBXF/ysqUZg5zGXsYIHuvTVKfsg/UvuGwpdfeWzsOczbzdYnDFhP5902 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)(13018025)(13016025)(3002001)(10201501046)(6055026); SRVR:BN6PR02MB2737; BCL:0; PCL:0; RULEID:; SRVR:BN6PR02MB2737; X-Microsoft-Exchange-Diagnostics: 1; BN6PR02MB2737; 4:ArsMRiEsFvoCNBgsMgF+j2hDir9amuPa/DFla0f/tJFtoiMM96/2JddO+PFE4XD2OgTBSjhC4RuJrPc/1dobvMRhwG+qizjZhdnb68a7JKP4R1tmX88nY6BWOsA+ClCWFVNDiQHmJRdfhDmfo3kXDMX9cdYswp1jZfhCxQD79QBIukEq62FXDW3DHrmVELnjzNXLsjx0Qelim6/JEIpbH1SFMq06sJWR2qnL6ZUJKDzaBP/6EW0baiwY8Br3/5GRndC8qTJnpDK5a58/NXHvU+8CL+iI2XT0ZzqtOEy/S2rw0XpavfIySV5HAj9EsWudVUCAoIQ+JXkZVhnaeQ2aLFjyokc3KgePpaz4XC1zfJgVOew0RIAwfrQck7T2NbougS4ML9rZNptI/3tbBeVB74zDRGfpHAEhmYWtk1aPPupMu8cO6Pr9EPk20XETrHgdw+DQZtu6t84q47DJL661nnxoSvjnoylVHxRr8Txggls= X-Forefront-PRVS: 00770C4423 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTjZQUjAyTUIyNzM3OzIzOk4rV1V6enlYZ1RlSXNkb2t6UW9tcTNDUjMx?= =?utf-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p0jFj66rQ8Jtmk5yuxYxVRtLhTORD6tv9RjBu3Y/pvR7EoJ/2U/XIRvpLA18UdXdi2e91Q/TpkpyDy9DFfXjflkkBqOJa16pOSMDQ9OAeBdZe+P020YM/+wMT8Ljo3GMcWOod8xY+VJ+XjXifeo06bbNKXlkgVRbey X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2016 18:26:51.7481 (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: BN6PR02MB2737 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. Signed-off-by: Bart Van Assche Cc: Mike Snitzer Reviewed-by: Hannes Reinecke Reviewed-by: Johannes Thumshirn --- 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 182b679..1b7a65e 100644 --- a/drivers/md/dm-rq.c +++ b/drivers/md/dm-rq.c @@ -116,9 +116,12 @@ static void dm_mq_stop_queue(struct request_queue *q) queue_flag_set(QUEUE_FLAG_STOPPED, q); spin_unlock_irqrestore(q->queue_lock, flags); + /* Wait until dm_mq_queue_rq() has finished. */ + blk_quiesce_queue(q); /* Avoid that requeuing could restart the queue. */ blk_mq_cancel_requeue_work(q); blk_mq_stop_hw_queues(q); + blk_resume_queue(q); } void dm_stop_queue(struct request_queue *q) @@ -901,17 +904,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;