From patchwork Thu Sep 29 00:01:45 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: 9355409 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 877166077A for ; Thu, 29 Sep 2016 00:02:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78C06296A3 for ; Thu, 29 Sep 2016 00:02:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D4E0296B5; Thu, 29 Sep 2016 00:02:06 +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 E9D06296A3 for ; Thu, 29 Sep 2016 00:02:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754805AbcI2ACD (ORCPT ); Wed, 28 Sep 2016 20:02:03 -0400 Received: from mail-bn3nam01on0070.outbound.protection.outlook.com ([104.47.33.70]:5632 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753938AbcI2ACA (ORCPT ); Wed, 28 Sep 2016 20:02: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=tFZy5bhTZHh5Yj3Wa8k1Sl1whwu/toj2HUHt4fdTWJs=; b=Jij488Cxcnc3FtYowwF4a4Qy7poYY1Kdqk43f5JJb18jughvWTc1T1UoiSFiWOnTgQmLBkuDBkAfjdAjHqHL71vhsLP/y2RqWfO23Xs7+uppUeaO5U+Zt8FITKNwmhkPfNFm3ldmgzNom5+PcFsQFP5LWNun6hlFKGqCscSByvE= Received: from BY2PR02CA0048.namprd02.prod.outlook.com (10.141.216.38) 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:55 +0000 Received: from BL2FFO11FD037.protection.gbl (2a01:111:f400:7c09::144) by BY2PR02CA0048.outlook.office365.com (2a01:111:e400:2c40::38) 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:54 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; fb.com; dkim=none (message not signed) header.d=none;fb.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 BL2FFO11FD037.mail.protection.outlook.com (10.173.161.133) 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:01:50 +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 4A.D7.26959.8975CE75; Wed, 28 Sep 2016 16:51:52 -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; Wed, 28 Sep 2016 17:01:48 -0700 X-AuditID: 0ac94369-b97ff7000001694f-24-57ec57987a7a Received: from exp-402881.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 55.E3.03606.9E95CE75; Wed, 28 Sep 2016 17:01:48 -0700 (PDT) Subject: [PATCH v2 7/7] [RFC] nvme: Fix a race condition 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: Date: Wed, 28 Sep 2016 17:01:45 -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+NgFprPIsWRmVeSWpSXmKPExsXCddJ5ke6M8DfhBh9Wq1j833OMzeLl+Q+s FitXH2WyWDUxz+Le0S9MFntvaVvMX/aU3eLZoV4Wi+7rO9gslh//x2TRtvErowO3x8Tmd+we i/e8ZPJ4cGgzi8fmJfUeu282sHl8fHqLxeP9vqtsHp83yQVwRHHZpKTmZJalFunbJXBl7Diw hLHgI09Fw8ItbA2Mv7i6GDk4JARMJNacleti5OIQEljKJPH50hEmCGcHo8S3OS8Zuxg5wYpO 3t7PDlXFKLGi+w0TSEJYwELi8rT5rCC2iICsxPfdr9lAbCEBO4lp85sZQRqYBT4wS7ztPQqW YBMwkvj2fiYLiM0LVPRuzks2kDNYBFQllq7QAAmLCkRI3HrYAVUiKHFy5hMWkBJOAXuJ6081 QExmAU2J9bv0QSqYBeQltr+dwwyySULgJ6vEjmlLWSBOUJc4uWQ+0wRG4VlIJs1CaJ+FpH0B I/Mq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8c7kqAgAA 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)(6666003)(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; BL2FFO11FD037; 1:aUe7B8kIFaI3rsf5c9Yf8TXo1KFvOHeLdwrnaU6224X+X/NaYGiRJyBwaB/nzTb5A+GvNJ57pSBoJRhZ6RfmTMHCE0cZy5Enq0aJzXwmvfIkdCrIeVXvlfULU66F7pExBQJyc4aAMnr4jtMyp6Vo38oFxZQQkpBDc12lgz9NxsP5YiaTVSZV4LaVLdGAyowmuyMMPM0eAYqJ9GurzOKqRiPskVfSwwLmTIHRe7RbQmXYW/Yqh7+olYvuQR4AQvd5jETGoABPMfmjjVHEE02a4WonUcExaZ6vv4ORTQ5pLp41JfByGPCc2QKCyt61HrtKkYiXkqHh1duodpu0bCFT65j+ZPDhkAZelngBeTfvHnT5khPgiIuba2C7hzhtbTdMXRRcn1hNcbX+E2cxwpWLEfA0rrYW0gIW+tXxAVj/AemTbGXvqDK7VDk1TeiFy1x+YgpZU9kzVFQPFyqZ7OMCwMMYCXo5ZYt/WXj/Gkb/G6kEEPU/Tf3K5kKcABcV4usJp8tyzQnucxSY/fGEU//fGQ== X-MS-Office365-Filtering-Correlation-Id: f5ae390a-9ff2-4efb-0006-08d3e7fbd239 X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB2130; 2:AHgsFFc44GQbU0WeDrXwyk20bMhB+BbWp/H/Nz1/7Ts4CRGqawtDALzP6OVLK2Pzqk0jqGvLCUEnFacBY//QKFUSP3sxIRX+f1ppwHP5ic2o9GZQXW5FE1Q1qv2Pa9LtY5WS0ZNcCFXBDkbO0bJ8NNNzf0ads+AWhaVGtZFr836GeS3tgFGgm3kmShxKcBb6; 3:3a4t/ycDdJ7TNW2wL6RGVn8wVneO6RMAU1KBlG4QBM40J327cpunzBb9oDFv4GHLb8DTVymkYZPW+tdi4dGEzxYNkGLCye23V2hxBcylbt5ePDhwpbku/CcXLHoWc/qhVKSHrTI9NgIcxbuAxYFITuw7c0x4f/8M+0skISCOFs9XRpbFcYxsryGuwMBSVTwu44x6aoZJhaVEqN0jlMu/c2nmC/yC+5sffvf9+x4Wkwr6Uc1vviz1hEMRlXv6fxGnzlXlU0yMbyxVD2b1Wa1+dw== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:BL2PR02MB2130; X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB2130; 25:6Y7J7ikznPcxiHeH1+uwN6Y00Qf/vuE+2J+CrmFyPU+IY6lGVF3jQpMcVU5D4j/oNEMQUA2g0LJbUdpq89N76Mny8R8JViK8DbuGzDYFjC9p7ojve6Me4AJcwsFd0cXdUJHK2VxsfuCzzOzDa7ufX2bnT4nDujG5ZXyMuUe3FalpGCHDrMbaD70uYR1OK0BjqzVVG5rYKBnazL7r5wa3RhGUi47ixsWLbB+GB7PQsZnia71i1/K2LRp6vQcdRwnt1pDCkqvo5FEWnkVYQJyLD60d3P18QrCsZnewWsC2JKuK/up6UaWN6s8K7AUBr5/pi1XpQkf4RlAwLshIpcpYK7Fi8Ch4yvNtYqUdnGJr1Ysd1ABk3j6+wV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2QxKBiQAGwsvgw+1bZWWCJ3KnhAROUX6Q2eJhNUaJl0ka+qRdCIchzQsdq+Gf+SZqaBu2JESTeA7vapyGUhWrh9gufgY/ZuNXq4hDbDIIPLmxTlpTUWwlHgrH+0994M2jfEl 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)(13018025)(13016025)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:BL2PR02MB2130; BCL:0; PCL:0; RULEID:; SRVR:BL2PR02MB2130; X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB2130; 4:5Wn3XWFJaAJi0vUQoqZ8S8CHty6Ud6qokWSkIHrr9SFyfxuhA5vMiDGq8k2i0rXywWu472jZK6zvRJ6xCTr7FdSLDbHJAms8XkEgHYX8LKmpAmlnXY5qlhkbXzDfyMWv4ubW7FgEqf2pAtb2a6V5pWNxNS6YDVo9IhR9GYOMjhyLpxGlXe0SZIgcfEju1dQZJOdv6NswulcerBWOdtBQ752GpgtezKmf0Ijow/pJKDgxPTPw67V/RF0xUG60nRIAZmj+Z4qVwsCCTW2y3WlyT65dHDwsGXJpGGI5JzLLdEz0y1JWUYookNpgPhT2Yvx0yHuEScwVHULKD0C3In12yW+ufcnslQm6emQYVuIUT/TTBHMvIbqIKnwS/7g5GjUm7dLO9DhjoQURF+SLvPVY6DaMf4++hJby//b8ZztCa5FQwQeET/xsZrRxSmjb7jpgZkRMasy6W1TYNXsvmc5Cqdg0MLXMmNI4FAynl9BhJ9aiZSJnan/00FYUfaHBViq63rAvy7bItvqci82IaDi47Q== X-Forefront-PRVS: 00808B16F3 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTDJQUjAyTUIyMTMwOzIzOjdlUEZJbFlIdS9GYlFoZU05cjlMeFlYRWlE?= =?utf-8?B?UjZhNGhaRlVrZWhXQVZuZC9zWlhpRnU2MERkci8x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EByluOgzc/3njL+BooQ7yLYg4YkL7jWVoIbrHhbj+l47cmYDw91UhZd69A2pLhyxBkKlpSLy6AGFNG76KkiXmO211b32v7NJkEsKRmkFiPSXBNrnbxyp39wnCnY X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2016 00:01:50.0754 (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-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. Untested. Signed-off-by: Bart Van Assche Cc: Keith Busch Cc: Christoph Hellwig Cc: Sagi Grimberg Reviewed-by: Sagi Grimberg --- drivers/nvme/host/core.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index d791fba..98f1f29 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); @@ -2077,11 +2073,19 @@ 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_quiesce_queue(q); + blk_mq_cancel_requeue_work(q); + blk_mq_stop_hw_queues(q); + /* + * Note: blk_mq_resume_queue() does not affect the value + * of the BLK_MQ_S_STOPPED bit. + */ + blk_mq_resume_queue(q); } mutex_unlock(&ctrl->namespaces_mutex); }