From patchwork Mon Sep 26 18:28:59 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: 9351165 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 BFC93607D6 for ; Mon, 26 Sep 2016 18:29:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B38F42895B for ; Mon, 26 Sep 2016 18:29:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A7BB628A20; Mon, 26 Sep 2016 18:29:11 +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 7E4E02895B for ; Mon, 26 Sep 2016 18:29:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422723AbcIZS3J (ORCPT ); Mon, 26 Sep 2016 14:29:09 -0400 Received: from mail-bn3nam01on0081.outbound.protection.outlook.com ([104.47.33.81]:53242 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1162880AbcIZS3I (ORCPT ); Mon, 26 Sep 2016 14:29:08 -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=oWP08dcCef7EjCwrkF9l6bmRmN+z6pg9TAEf70F/YMc=; b=ac43eTJfFouvY+63JXVqK2dDN3DFeDsWLjSH8g21iLdSzhTayZvppTpCLbE3gD2SyTU6bfi83itKvph1s42TJYN4z2THMbx3s/VQyq/QQ421Z1y9aklICRkcGnlVaLcxUgQ8VweOk5HYdPvppocvKc7mkL0N8MX8fRIsVY2SdHM= Received: from BY1PR0201CA0005.namprd02.prod.outlook.com (10.160.191.143) by MWHPR02MB2749.namprd02.prod.outlook.com (10.175.49.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.639.5; Mon, 26 Sep 2016 18:29:05 +0000 Received: from BY2FFO11FD056.protection.gbl (2a01:111:f400:7c0c::190) by BY1PR0201CA0005.outlook.office365.com (2a01:111:e400:4814::15) 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:29:05 +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 BY2FFO11FD056.mail.protection.outlook.com (10.1.15.193) 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:29:00 +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 97.D8.26959.C9669E75; Mon, 26 Sep 2016 11:19:08 -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.301.0; Mon, 26 Sep 2016 11:28:59 -0700 X-AuditID: 0ac94369-babff7000001694f-af-57e9669ce6de Received: from exp-402881.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 39.DF.03606.BE869E75; Mon, 26 Sep 2016 11:28:59 -0700 (PDT) Subject: [PATCH 9/9] [RFC] nvme: Fix a race condition 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: <9c372b04-a194-58c4-a64f-b155b52a5244@sandisk.com> Date: Mon, 26 Sep 2016 11:28:59 -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+NgFprPIsWRmVeSWpSXmKPExsXCddJ5ke6ctJfhBtOvGlr833OMzeLl+Q+s FitXH2WyWDUxz+Le0S9MFntvaVvMX/aU3eLZoV4Wi+7rO9gslh//x2TRtvErowO3x8Tmd+we i/e8ZPJ4cGgzi8fmJfUeu282sHl8fHqLxeP9vqtsHp83yQVwRHHZpKTmZJalFunbJXBlvJug V/CNu+LLyS3sDYxzuboYOTkkBEwk/l47ydbFyMUhJLCUSWLXwQ5GCGcHo8SN+8uBHA6wqvVH taGKGCW+rN/JChIXFjCV2P6nCGSQiICsxPfdr9lAbCEBO4lZs9vAhjILfGCWeNt7FCzBJmAk 8e39TBYQmxeoaOXjk6wgNouAqkT73D9MILaoQITErYcdUDWCEidnPgGzOQ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6tXw2Km7NU30Tzy6Lbrs+fw9 zsm3fok0ZNxgmc4wPevy7kunK/73zjkpwy0sqMRSnJFoqMVcVJwIAPesU/gpAgAA 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)(586003)(189998001)(33646002)(53416004)(230700001)(2270400002)(31686004)(8936002)(31696002)(54356999)(50986999)(76176999)(229853001)(77096005)(50466002)(106466001)(86362001)(64126003)(65826007)(5660300001)(110136003)(87936001)(83506001)(69596002)(19580405001)(19580395003)(2906002)(4326007)(68736007)(36756003)(97736004)(626004)(4001350100001)(7846002)(47776003)(11100500001)(2950100002)(8676002)(305945005)(92566002)(81166006)(65956001)(65806001)(6916009)(7416002)(356003)(81156014)(23676002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR02MB2749; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD056; 1:gqbEw75158BG25NlWjhuoNe8+7/6AgTtfss33OWQbda0NpkavvL3sIjee+jnPyUnwTsoPO2uEl3FhEf6rS3L7GM00YmWViA5LmBCOGGZG6iRrLeaT6mge3uHYL1EuSrGGKU5JpnNsPmYvaPvX+NLNme26iph2eK5tYoFYFvBwFuG5OMnTdr9tIHqPu5/a9BpmNTdoGDccO77CkEMWchkzzBrIr5Ngx+WIs27EYjKUHx6wNP1Z8S7y5jjDUijxEAT0QaywaKtFq9rL6hiEApiRZ0tLCF4xl0vTyDdoAxSLyqwtuf234HpqLlHr2zl8w/oZpaipDmgSY9/Cn77XvslzoIm3SC5SZkrqo1OHCfWwJIJWtgf9QCgzf5LbQnl7snpvsNFAFbzy3+aTlX0ShXoGqanRtXUJnBVqsenTqvxccUZvuvf1Op0UN2JqD1TYon2cI/MtWe6RGPz3/v4wkf2A6Qhj2/PTRyUlhXOd54qMFZf0QJhx/8leTYhsOrFH9yEKjzx2zGEGEOrwi2eehkZkQ/yrTV3G5IIFnD/UWGWGl8CIMqCTn/bTPoPPh/RaEkE X-MS-Office365-Filtering-Correlation-Id: 36693c3f-10f7-4b5d-6a2f-08d3e63afee4 X-Microsoft-Exchange-Diagnostics: 1; MWHPR02MB2749; 2:1Tepo/f+1xCSVFiGeuS5buI+vcZ+M2NpHuU4Xph568Gg16CZh0MMCOg5S+hnCwAtVW3/r21cSqfR0nOzkE00rPKQ0rNWNaizVPe4BPjm7U70q49fBrX1/6BwBjNEw3Q+hq7SYIUuUCcn5RC8wYM9vGVDvtJF04SsCrLyzF7y2PVX+4xb2upDJHGQuhsENCng; 3:RyOycmHIT51y72gXbHJ07MedxJ8+zuw+Nqmc6RALWd6hQDUIgPmrLiKJw67LzXEh7hPAblQHNM7jerBqfznhmjkfb8hj9QYe6AW41QRwW56iuwa5ifYKnoLLajVYxW8XwQtTdxMSPAL+hsHL+Q3Bv13VD6kcJcnrLt/dPGSg2aOkj7xp3Fmpro5ydD9aoVJ+ClshDBVeAGOcR2Fby0eagqNXiGxOyMOIe4QYgWLedAgRvNWvLIUEssa1p2TgCbxmQLIT7oaLH8sLps/8NUxbGg== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:MWHPR02MB2749; X-Microsoft-Exchange-Diagnostics: 1; MWHPR02MB2749; 25:SMo+PQt01op6ExXFKyTMjg4pEwTvhEPOMGgmoe3tv6q/xSrCUtqiTt8+FzJcyx+jLpwIPaKQT68B6TYKxrSe9F2y17KszgO4ZUXCHHMTz4CZYJGca3p3NyOYUPNndQ5ns7OGd678i/CjH7rw5oqZfKCIq5U04BXa2BWwoJwZKE0MS5B0eH++R5958tG9ArsBlxKIo41vCSqvcMn1qi066vuk5x0lgLP6N7cJtQg9Tg+6t5Hy8aOMaclxj/1GM4A8EDQethElvY5WepPX1nAdRbIJf5e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joOXHteuJy9wq+rpPSG3nWwHE6DsCP5bmAp5CEIpzJNf4pe3ZY3aA2QxznMltELuhbeg1iavE4zK8D4O5qBUmYaMPOEN7cq8pJGw+eyO+QK+87m2RbOkkw5wH49fa+3uQ4xWk6nVLsNphNalBeEcx8IwR9J19FxHTGE5LRB0nmkbHvgyYj1wDzMhfnsrnvP2xjQLMLg/QRJ/EZ5Dnz 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)(5005006)(8121501046)(13018025)(13016025)(10201501046)(3002001)(6055026); SRVR:MWHPR02MB2749; BCL:0; PCL:0; RULEID:; SRVR:MWHPR02MB2749; X-Microsoft-Exchange-Diagnostics: 1; MWHPR02MB2749; 4:0u6XyRMvnbC7J5Umq4xUSve3QvkCta7Ku5ZtWV5mbYNpGn9sVT6wtVcqPjDnUxD8AFUpSJS1w3cPluZhMHzHSuj3r+g0JvixUv/h7uIw1KKRBFoH6fj4Nn2zUnaI2KSNdPlPJ1PBYWpk0CpVXGk0kreA3WhKsTcxJMjZdW3GHOnJhKUWw8yuuly3nGOOYSAPsiD6MM0Gm44vZm6qrUtIi8LdWYfrEHUNEKdVOhTp/b8nL9Wh0OsjHazDV/G95kaTe/yQQCLyTsxHd8XwSOH6CI7dHCsl236LocSIC92ki8ymst5pI9zdoOUXz2p8qctP5SRCHIhLCd3C0KcV+iAUMBFuyJhZbZ5T9Tf9YqmOXY50NWFmvFTrDt8G9UcaBYL5wE0Q+HZV34/uBDtkkJECHXJdRAw2b2mrUrtGHGC9s7I+j1f08RoUyR4sfwkiZrjCvfUBxw3WVVwmEctm7t9nw5aAnxF7qYPga5efLtivH/BglBvfSH+8EU3Ld2HEofaR2wCtrkx05N61+LOd0w38LQ== X-Forefront-PRVS: 00770C4423 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtNV0hQUjAyTUIyNzQ5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Y47QbA/Sb6ZC9fLsXYnpGlKwn0St5FdnuX8Z58/D19hSzdn+pkvAnv5jeY6FKPV527863WFrK1ewo+CNdFWIHFYCSZvTU8a/g5k+0Vt6qZMI9RlOjGRX5Q1Ai0v9t2cyvZf3sylF9QfsagwkAxCTbLXwzPuQriVoNyu1lUW2Cf4MVWWS8RUHedfSTSI7RcQ X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2016 18:29:00.8778 (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: MWHPR02MB2749 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 Avoid that nvme_queue_rq() is still running when nvme_stop_queues() returns. Untested. Signed-off-by: Bart Van Assche Cc: Keith Busch Cc: Christoph Hellwig Cc: Sagi Grimberg --- drivers/nvme/host/core.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 057f1fa..6e2bf6a 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -201,13 +201,9 @@ fail: void nvme_requeue_req(struct request *req) { - unsigned long flags; - blk_mq_requeue_request(req); - 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); + WARN_ON_ONCE(blk_mq_queue_stopped(req->q)); + blk_mq_kick_requeue_list(req->q); } EXPORT_SYMBOL_GPL(nvme_requeue_req); @@ -2079,11 +2075,15 @@ 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_quiesce_queue(q); + blk_mq_cancel_requeue_work(q); + blk_mq_stop_hw_queues(q); + blk_resume_queue(q); } mutex_unlock(&ctrl->namespaces_mutex); }