Skip to content

Commit 081f5e7

Browse files
keithbuschChristoph Hellwig
authored andcommitted
nvme-pci: fix freeze accounting for error handling
A reset on a live device experiencing a link error still needs to have the queue freeze state started for the subsequent reinitialization. Skip only the register read if the device is not present instead of bypassing the freeze checks. Fixes: b98235d ("nvme-pci: harden drive presence detect in nvme_dev_disable()") Reported-by: Niklas Schnelle <schnelle@linux.ibm.com> Signed-off-by: Keith Busch <kbusch@kernel.org> Tested-by: Niklas Schnelle <schnelle@linux.ibm.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent 6b0de7d commit 081f5e7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/nvme/host/pci.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2690,8 +2690,13 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown)
26902690
struct pci_dev *pdev = to_pci_dev(dev->dev);
26912691

26922692
mutex_lock(&dev->shutdown_lock);
2693-
if (pci_device_is_present(pdev) && pci_is_enabled(pdev)) {
2694-
u32 csts = readl(dev->bar + NVME_REG_CSTS);
2693+
if (pci_is_enabled(pdev)) {
2694+
u32 csts;
2695+
2696+
if (pci_device_is_present(pdev))
2697+
csts = readl(dev->bar + NVME_REG_CSTS);
2698+
else
2699+
csts = ~0;
26952700

26962701
if (dev->ctrl.state == NVME_CTRL_LIVE ||
26972702
dev->ctrl.state == NVME_CTRL_RESETTING) {

0 commit comments

Comments
 (0)