Skip to content

Commit cc1d5e7

Browse files
author
Keith Busch
committed
nvme/pci: Sync controller reset for AER slot_reset
AER handling expects a successful return from slot_reset means the driver made the device functional again. The nvme driver had been using an asynchronous reset to recover the device, so the device may still be initializing after control is returned to the AER handler. This creates problems for subsequent event handling, causing the initializion to fail. This patch fixes that by syncing the controller reset before returning to the AER driver, and reporting the true state of the reset. Link: https://bugzilla.kernel.org/show_bug.cgi?id=199657 Reported-by: Alex Gagniuc <[email protected]> Cc: Sinan Kaya <[email protected]> Cc: Bjorn Helgaas <[email protected]> Cc: [email protected] Tested-by: Alex Gagniuc <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Martin K. Petersen <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent 80f513b commit cc1d5e7

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/nvme/host/pci.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2681,8 +2681,15 @@ static pci_ers_result_t nvme_slot_reset(struct pci_dev *pdev)
26812681

26822682
dev_info(dev->ctrl.device, "restart after slot reset\n");
26832683
pci_restore_state(pdev);
2684-
nvme_reset_ctrl(&dev->ctrl);
2685-
return PCI_ERS_RESULT_RECOVERED;
2684+
nvme_reset_ctrl_sync(&dev->ctrl);
2685+
2686+
switch (dev->ctrl.state) {
2687+
case NVME_CTRL_LIVE:
2688+
case NVME_CTRL_ADMIN_ONLY:
2689+
return PCI_ERS_RESULT_RECOVERED;
2690+
default:
2691+
return PCI_ERS_RESULT_DISCONNECT;
2692+
}
26862693
}
26872694

26882695
static void nvme_error_resume(struct pci_dev *pdev)

0 commit comments

Comments
 (0)