]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.17.12/nvme-pci-fix-aer-reset-handling.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.17.12 / nvme-pci-fix-aer-reset-handling.patch
1 From foo@baz Sat Jul 28 10:14:30 CEST 2018
2 From: Keith Busch <keith.busch@intel.com>
3 Date: Thu, 24 May 2018 16:16:04 -0600
4 Subject: nvme-pci: Fix AER reset handling
5
6 From: Keith Busch <keith.busch@intel.com>
7
8 [ Upstream commit 72cd4cc28e234ed7189ee508ed65ab60c80a97c8 ]
9
10 The nvme timeout handling doesn't do anything if the pci channel is
11 offline, which is the case when recovering from PCI error event, so it
12 was a bad idea to sync the controller reset in this state. This patch
13 flushes the reset work in the error_resume callback instead when the
14 channel is back to online. This keeps AER handling serialized and
15 can recover from timeouts.
16
17 Link: https://bugzilla.kernel.org/show_bug.cgi?id=199757
18 Fixes: cc1d5e749a2e ("nvme/pci: Sync controller reset for AER slot_reset")
19 Reported-by: Alex Gagniuc <mr.nuke.me@gmail.com>
20 Tested-by: Alex Gagniuc <mr.nuke.me@gmail.com>
21 Signed-off-by: Keith Busch <keith.busch@intel.com>
22 Signed-off-by: Christoph Hellwig <hch@lst.de>
23 Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25 ---
26 drivers/nvme/host/pci.c | 14 +++++---------
27 1 file changed, 5 insertions(+), 9 deletions(-)
28
29 --- a/drivers/nvme/host/pci.c
30 +++ b/drivers/nvme/host/pci.c
31 @@ -2679,19 +2679,15 @@ static pci_ers_result_t nvme_slot_reset(
32
33 dev_info(dev->ctrl.device, "restart after slot reset\n");
34 pci_restore_state(pdev);
35 - nvme_reset_ctrl_sync(&dev->ctrl);
36 -
37 - switch (dev->ctrl.state) {
38 - case NVME_CTRL_LIVE:
39 - case NVME_CTRL_ADMIN_ONLY:
40 - return PCI_ERS_RESULT_RECOVERED;
41 - default:
42 - return PCI_ERS_RESULT_DISCONNECT;
43 - }
44 + nvme_reset_ctrl(&dev->ctrl);
45 + return PCI_ERS_RESULT_RECOVERED;
46 }
47
48 static void nvme_error_resume(struct pci_dev *pdev)
49 {
50 + struct nvme_dev *dev = pci_get_drvdata(pdev);
51 +
52 + flush_work(&dev->ctrl.reset_work);
53 pci_cleanup_aer_uncorrect_error_status(pdev);
54 }
55