Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5989047ybc; Wed, 27 Nov 2019 13:00:21 -0800 (PST) X-Google-Smtp-Source: APXvYqxF3rCuvpeyLAwPLrjUsdCo1WZ3BoLO/sfMa4GsFfZc/jPO/rBN5+jxGwdxZAxnIFIF9uVk X-Received: by 2002:a17:906:604e:: with SMTP id p14mr51818644ejj.257.1574888421090; Wed, 27 Nov 2019 13:00:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574888421; cv=none; d=google.com; s=arc-20160816; b=oNVm8yTam42CJ9ti+3KwxTpbEFYtuVq1lxDOgx/xU4OlabGiVtPcvrlI/Ex+s/cYdW coCwKDxp9hK9EmDZIMUE41mwWYsazl/BnJF4rywjcn9m6FP9PVDybQqoqzqK0kP7eom4 PkrC3bZGSQlRZnfGDOzSHrJHlofVoGf9dJ0SMiAy+UQ96otGmfLKQ21Kd6x8MfoyQbd0 yHZKl78yGEQtrhE8ipadTkhonHhciU4LkaBYDeaI0fnHo1IHU1gqUrQEzhjeANo6LKOJ o98M8XajmABKQB+WOfpryfY2f7010CnoNbf7B+nMh/4TrTuxjWsztImoNdsbVRQqw1Tg 17kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=po1HK7+BoDmdPMXS3BeVvUfREuNnyOitubrfsZL0Wgw=; b=PtKgn8YqhiDtZoUD289i1yOnyN8q7AjrfQwVBU3txo+0Wx0siG8Uvdo56uFJgv+eLU MmCpLhAbck/UOzIcnCkOSkSmYuXmjg7+eWrev7oyaTBgtgFy4u6eZQ5QE7TajjWEEZW6 asaUAoP15EOJhNRgqarMSQUGoOq6oTMov8jtN2GNiS1Lox7VhpMfqmPlvsPlmyWYbscL 0d/N+nv0oJOgL1Uk4fX7BgYukDgz1T+zofLmaNcCFP1UKeG6w0czIei0cfhV5mweX7AK co+UD7MJm6DJljIa+8JjwqPJfSIhFV1O93FTDG1jFdHR0XyY/gmLpId2DxkawNZ6OioQ Scqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RsS9Kx7t; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n26si3933282ejz.245.2019.11.27.12.59.56; Wed, 27 Nov 2019 13:00:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RsS9Kx7t; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730355AbfK0U6O (ORCPT + 99 others); Wed, 27 Nov 2019 15:58:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:49414 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731287AbfK0U6L (ORCPT ); Wed, 27 Nov 2019 15:58:11 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C68FF2084D; Wed, 27 Nov 2019 20:58:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888290; bh=+5WDG++5xSQuxpiwkJ1J9wYvQqH+k4jLnKBFQ/nlJIE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RsS9Kx7tlMRMQnmpCDs+Fh/KT+k8jTmOrhKePLmDVxmWKc4WEoroMc9mVKscf0AlH zW2lpEng6GU8MNPyc3M0uupaWaia7du2qANgGCBhFKmwXTguaEWnJRldAHU9jsUbOH Adr3sCUzTXsjDUHgFstcU83Y9fOtNjUBx5RSQlLM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Keith Busch , Sagi Grimberg , Christoph Hellwig , Sasha Levin Subject: [PATCH 4.19 077/306] nvme-pci: fix hot removal during error handling Date: Wed, 27 Nov 2019 21:28:47 +0100 Message-Id: <20191127203120.503867385@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203114.766709977@linuxfoundation.org> References: <20191127203114.766709977@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Keith Busch [ Upstream commit cb4bfda62afa25b4eee3d635d33fccdd9485dd7c ] A removal waits for the reset_work to complete. If a surprise removal occurs around the same time as an error triggered controller reset, and reset work happened to dispatch a command to the removed controller, the command won't be recovered since the timeout work doesn't do anything during error recovery. We wouldn't want to wait for timeout handling anyway, so this patch fixes this by disabling the controller and killing admin queues prior to syncing with the reset_work. Signed-off-by: Keith Busch Reviewed-by: Sagi Grimberg Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/pci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index a64a8bca0d5b9..9479c0db08f62 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -2583,13 +2583,12 @@ static void nvme_remove(struct pci_dev *pdev) struct nvme_dev *dev = pci_get_drvdata(pdev); nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DELETING); - - cancel_work_sync(&dev->ctrl.reset_work); pci_set_drvdata(pdev, NULL); if (!pci_device_is_present(pdev)) { nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DEAD); nvme_dev_disable(dev, true); + nvme_dev_remove_admin(dev); } flush_work(&dev->ctrl.reset_work); -- 2.20.1