From patchwork Tue Oct 18 21:53:35 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: 9383161 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 4061D600CA for ; Tue, 18 Oct 2016 21:53:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E0262881F for ; Tue, 18 Oct 2016 21:53:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20507297E5; Tue, 18 Oct 2016 21:53:45 +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 7E0662881F for ; Tue, 18 Oct 2016 21:53:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932183AbcJRVxn (ORCPT ); Tue, 18 Oct 2016 17:53:43 -0400 Received: from mail-by2nam03on0062.outbound.protection.outlook.com ([104.47.42.62]:58912 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756092AbcJRVxl (ORCPT ); Tue, 18 Oct 2016 17:53:41 -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=CpytvQRYA15131rbkdqr17fJnIPZzTh1Q3DTZwPKaNs=; b=QiUl1UNqYHXU7GfPZ3wdi2zokDQW4C83SpCODDLAc7wJ1eF6iny2ncrhHrTgGo7CQ8K6xrdbzNNo3QIXEgowSumIqgnYUUZkU+Sq2yVOzwjeigPfaNC2RLz2nN3YukSJoO6kghy5SGT6997mRusEHeDw7TWTzMOWjdiCdwv2aog= Received: from BN6PR02CA0053.namprd02.prod.outlook.com (10.175.94.143) by CY1PR0201MB1913.namprd02.prod.outlook.com (10.163.56.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.659.11; Tue, 18 Oct 2016 21:53:39 +0000 Received: from BN1BFFO11FD043.protection.gbl (2a01:111:f400:7c10::1:117) by BN6PR02CA0053.outlook.office365.com (2603:10b6:404:f9::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.12 via Frontend Transport; Tue, 18 Oct 2016 21:53:38 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; lst.de; dkim=none (message not signed) header.d=none;lst.de; 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 BN1BFFO11FD043.mail.protection.outlook.com (10.58.144.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.7 via Frontend Transport; Tue, 18 Oct 2016 21:53:37 +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 59.DD.26959.06796085; Tue, 18 Oct 2016 14:42:56 -0700 (PDT) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.319.2; Tue, 18 Oct 2016 14:53:35 -0700 X-AuditID: 0ac94369-ef8199800001694f-82-58069760e743 Received: from exp-402881.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id AA.B3.03615.FD996085; Tue, 18 Oct 2016 14:53:35 -0700 (PDT) Subject: [PATCH v3 11/11] nvme: Fix a race condition To: Jens Axboe References: CC: Christoph Hellwig , James Bottomley , "Martin K. Petersen" , Mike Snitzer , Doug Ledford , Keith Busch , Ming Lin , 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: <2a29b7ec-0113-3450-9a36-b925b47b1fb0@sandisk.com> Date: Tue, 18 Oct 2016 14:53:35 -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+NgFtrAIsWRmVeSWpSXmKPExsXCddJ5kW7CdLYIgyP/lS3+7znGZvHy/AdW i5WrjzJZrJqYZ3Hv6Bcmi723tC3mL3vKbvHsUC+LRff1HWwW5z+8YrJYfvwfk0V7bwezRdvG r4wOvB4Tm9+xeyze85LJ48GhzSwem5fUe+y+2cDm8fHpLRaP9/uusnm8fbmT1ePzJrkAzigu m5TUnMyy1CJ9uwSujDl9NxgLXnNXnLw7na2BcQpXFyMnh4SAicTs5lXsXYxcHEICS5kkpv5s YIRwdjBKvP24lwWm6sLxw2xQVYwSjz+dZQRJCAMlNkyZxQRiiwjISnzf/ZoNxBYSsJN4u34n C0gDs8BeFomHl2+xgiTYBIwkvr2fCTaVF6hoxvHXYINYBFQlZt9vBYuLCkRIbPo6B6pGUOLk zCdANgcHp4C9xNUD4SAms4CmxPpd+iAVzALyEtv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gmLav2ihUx42B2T 7l1ZGxjy7J/oN63Y9WV6C836RKZ5HjnwuORGo8nS9Suv3ja+a839jEf2qxJLcUaioRZzUXEi AN4WsmY6AgAA 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)(77096005)(54356999)(50466002)(68736007)(189998001)(92566002)(31696002)(50986999)(6916009)(230700001)(2906002)(356003)(106466001)(4326007)(87936001)(7846002)(65826007)(5660300001)(2950100002)(76176999)(305945005)(81166006)(65956001)(64126003)(36756003)(53416004)(11100500001)(7416002)(626004)(23676002)(47776003)(65806001)(8676002)(4001350100001)(110136003)(86362001)(83506001)(229853001)(586003)(19580395003)(33646002)(81156014)(8936002)(97736004)(2270400002)(69596002)(31686004)(19580405001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0201MB1913; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD043; 1:XJEgYZCM0NIQaOKgau/Q9fd3q2a/80IME6vvYyUoLje7+MFUfmC4LcXpjUf+dpwrwl1OuRsiCJzlb/8k7aHT/7wYozItST0UHq9TBJMcZd8wzwDAGxfHRiNr1s+8rgyzqhKwytxcUiz5qeI4esEhAd7/2tsSWW8Rgfh4/ZcQtLXjjlI/LqHHsKfLLozD0oM6rskJX+1VasB1hfy+M+urzuFj778XBGwdq8wkvljePM3Q10VvqbA2cL83sTz7qnUIsito6XSG0JriWvMWZu3S1B4T9Zfw/TBEjJdf+UHkN05i6BrADDgY2ayE4z8j8Xrv805JUWG1/MrF2+bd4/09aheMHDPxpL/zd/JzJEfOUItqf5fFYJsMU7eeUwEWQXqHYhUkVx+JNvnSvWyxjL9LiUWTbEQuwhla96qykog9aqG60B6YPaHMYYZ8tud4Q7xJ7K25xDIOFCIWWFn1LPcG7lixlMlgqyUy1KqJAm8Z2dEC/MQ3mEQ2ZR4cCZ8oXe2SQgPKjxol0NQm0mohP567kRkPWhfjcW2EFi4HKXu8NVvaEvdsKNBbqm0wbigpRkaj X-MS-Office365-Filtering-Correlation-Id: 55b4caab-b2db-40cd-d4fc-08d3f7a13799 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB1913; 2:do0zq1sB/n5QVC514xszVdrsrzohMXwP76gPDB1sZuIokNm9oimpQycXiOPuUG7NFObIRpKjCbQRixDIYIQuIs/nyXBcHcWA9Lf6cJsM49fvwYNpuyIgIyMgw/70rk+m2cbCoPMxBOSfc9bK6PDHBCKC7dsJHrGiRMFVVVco8BaQB5UQZcPHv+vCFxwGFoCMJvv667QKFKMa810QD6cxkA==; 3:SYt0dVPlTM8uj93nVtdniykKG+JDPoC/EGEG1TSNJsUKc7WC7B8r6J5YaEBUtcHLR0dnPQHwWqPusmpYBo6fHArc1O1RzfrjHshIxEmBTluAQJhe9rRmxlsc7+y/2vo5cRWOaEkeoSHiipdbuIoSO4IbT6LT3l3Dt5qWzf1eT9LE0NAeTVXwQCBQj9pujQtgxBnHyIOUAuZadyCnFsm6qVO+V36+fxoLHc6DFxBnHUUETQutWxgCj7dEY6y6AjEhfDMYDQXWivUDATa3m6fhm24+Px3VCGkamGsZ7tnYM0E=; 25:ECUDGqKnuNdnhhvgvXiMnlFvDuKHTofstdV3qPo++2pI/xMEh8tKqA3Ztst7jquKS/mvH98C0woBsWrehWxC5JLfyCqpQWkGutONY55HX8A7mlMCLFC1yw4FHTYCw+HJgrFG3OEgcDDOmhD1uhZIE7jJi8BXD/i8tKVCnRHLj3fpd9hVvm3UUk+YwjsMBCHq8RvROOQPxp7qYE6P9NfhndoIkvXg9tBFHHPnd7SHihUuaHV24gHK8jQO+3uMjRzPMn+RVg9bCAjZLuVIsSpIap7uoMf3602N0ranyM51DGzjWv5SltX8vordN2Py9gOAA503h0iLZgyyF3VDtCO+6UWKbqD8sLLmgTrettzrAtKEbpP0kHPG2sTg+tKa859x1hY18hY6um7sJQXSt7kz1IAMlQWx8 3az57EoWXB/AoAkRCs9FY95hNzrZH34RaVy X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:CY1PR0201MB1913; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB1913; 31:N0ydluOsf2hVP5UFZtcdZbjEtDVKMgAixF+Rv/aMwXi+QtGvIXO364rg6l+MjlisRwn3PiOOYJad7KXE+MZCyx0gtsULTNK6DgAoagHhz1ksDq+kWgwMDgnLog93RwmmvVrScyO+VzUtRw4OmjzgCD/234/qXbxKWqRWRG1OPEIm1WHmBkDjJvbR/9um3YFJRtcfyRktehrsxwBg/xGSmD9zh6A2Ie3oTjJYgfgajBMfMXlh7I3dKUjtYii+WZcrVWiqFlrsQue9qjRoX11cig==; 20:oXbwsB0cIxFNXH+HUhSU8/XSsVLLYbqtCrArFt1O+JgBwBJn11sJOc4eEq8XvV4ESHnRw1Py5cCGXRyLgsuAphujpLzPJ7wTy560FUoU9o+glKUvpanWii6eDoOgZol12+eX7jbbwGvm9Nr9LLgR3/oG2uP5WJ+RWRGVvlHLlEholzOcjlNb1FAyQJJXuecG+GhYjipb1zCE+d7K1neVExJKfD+aLkkBfrPmdkwFoFamS1jPgxnRL5Ba9MXs6jgvCyrDesMrAYiPsm1MWu42iLKtW8Ey6d1oAMAwyBkciuU0d+Yu1zrneM+J+e8lCOTh+hc39zM9sja+OvTWS0rw7KTPWxLlJu3Vjzd0+QPC4lonpSnjsRaTgi+sWoYyv2e501Kxj29mntqPnQHr4VH8muyxtD6OrX5tjpJ1iikj85l71h+lAIHKGkIrgOHhjA1Pe5YWCY28ewqcJMqfECf5OrVsvHnCwkqwxOP2rru+acxCRq5F/tTZTlaErXwxOnew X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(42932892334569)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(13016025)(13018025)(3002001)(10201501046)(6055026); SRVR:CY1PR0201MB1913; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0201MB1913; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB1913; 4:IXJQK053I7NLNl8bbNN6SkylwIDnno1nC0HLwmCe53df8yI0D8QchlG4Cb2zmuI78POazZtGBTo/J0ObCjJnEaFfBv+jdKATaKpWMnRBXNP0sAoZeihfcLZ+g6bfIjJDWKDwSOOSxP0wgAFcfFhdu7h18J4UBoOX7rnzLkhuoTsWTQLY5ZzRgybx53M5RgdnQprWSLC4LJtDZmUK18SDVSPzZZmjWJLhRtp+x6RoFyUh3ZXwvyCYmOZztc14m7Z2onRLt7C4vVAux0jArKSiMC5yquqi8d9ZRB9DoW3p0OWD7K+/Bta1q5VVLrhwJSLiGZ9As/JgzSpaV6dq3rcmaG0Qr7q+GuEaKYhR8sZO7pgvrhqCZYBy9IE3ev3lSBQ8VHAWarj0TOOi9eCyn1NME5XjisQS8XC1nm4VDrVuVJkpHN0KTAwEr74MYAmAqpzBptDzv7vaQCq4pbMCUhUi0Mvma2IEfODu8HgCv9I5kq/xpAoKkeL6lUBe28xxzYkhFe4Moi8PckGGvQ8WcgxIXh0TuLHewo8NPS2qKjoRoPw= X-Forefront-PRVS: 00997889E7 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTFQUjAyMDFNQjE5MTM7MjM6WmpNUlRBTDFpQ1dlYWdJbWdFbkhRS3g3?= =?utf-8?B?aS80bnM2cVEzMmhycTVsNE9DT1h0bG1QYUVKWDc3aVN2a2xhOXdXdk5TaFpF?= =?utf-8?B?Q3BROXhGbEdtWSs1RkNnbzhob2hacWRkR2Fvc1FwYkRFVEJ6KzNZSFNhWE9R?= =?utf-8?B?NlNGMlJaY1o1Y01QbmczeU5xQ1NJaUVtbFlWMmhuWjFvMTdHZ0orY0FxbmVu?= =?utf-8?B?SD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riginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2016 21:53:37.2139 (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: CY1PR0201MB1913 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 Avoid that nvme_queue_rq() is still running when nvme_stop_queues() returns. Signed-off-by: Bart Van Assche Cc: Keith Busch Cc: Sagi Grimberg Cc: Christoph Hellwig Reviewed-by: Christoph Hellwig --- drivers/nvme/host/core.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 18a265d..96f00c7 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -201,13 +201,7 @@ static struct nvme_ns *nvme_get_ns_from_disk(struct gendisk *disk) void nvme_requeue_req(struct request *req) { - unsigned long flags; - - blk_mq_requeue_request(req, false); - spin_lock_irqsave(req->q->queue_lock, flags); - if (!blk_mq_queue_stopped(req->q)) - blk_mq_kick_requeue_list(req->q); - spin_unlock_irqrestore(req->q->queue_lock, flags); + blk_mq_requeue_request(req, true); } EXPORT_SYMBOL_GPL(nvme_requeue_req); @@ -2074,11 +2068,14 @@ EXPORT_SYMBOL_GPL(nvme_kill_queues); void nvme_stop_queues(struct nvme_ctrl *ctrl) { struct nvme_ns *ns; + struct request_queue *q; mutex_lock(&ctrl->namespaces_mutex); list_for_each_entry(ns, &ctrl->namespaces, list) { - blk_mq_cancel_requeue_work(ns->queue); - blk_mq_stop_hw_queues(ns->queue); + q = ns->queue; + blk_mq_cancel_requeue_work(q); + blk_mq_stop_hw_queues(q); + blk_mq_quiesce_queue(q); } mutex_unlock(&ctrl->namespaces_mutex); }