nvme/pci: Fix stuck nvme reset
PATCH 1/1 nvme/pci: Fix stuck nvme reset
The controller state is set to resetting prior to disabling the controller, so this patch accounts for that state when deciding if it needs to freeze the queues. Without this, an 'nvme reset /dev/nvme0' blocks forever because the queues were never frozen.
--- drivers/nvme/host/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/pci.c +2 -1
@@ -1805,7 +1805,8 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown)if (pci_is_enabled (pdev)) {u32 csts =readl (dev->bar +NVME_REG_CSTS ); -if (dev->ctrl.state ==NVME_CTRL_LIVE ) +if (dev->ctrl.state ==NVME_CTRL_LIVE || + dev->ctrl.state ==NVME_CTRL_RESETTING )nvme_start_freeze (&dev->ctrl); dead = !!((csts &NVME_CSTS_CFS ) || !(csts &NVME_CSTS_RDY ) || pdev->error_state != pci_channel_io_normal);
Signature · 1 line
2.5.5
Christoph Hellwig
maintainerPATCH 1/1 nvme/pci: Fix stuck nvme reset
Quoted 4 lines · Keith Busch
The controller state is set to resetting prior to disabling the controller, so this patch accounts for that state when deciding if it needs to freeze the queues. Without this, an 'nvme reset
/dev/nvme0' blocks forever because the queues were never frozen.
Ouch.
drivers/nvme/host/pci.c static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown) · line 1809
Quoted 3 lines
drivers/nvme/host/pci.c +2
-1-if (dev->ctrl.state ==NVME_CTRL_LIVE ) +if (dev->ctrl.state ==NVME_CTRL_LIVE || + dev->ctrl.state ==NVME_CTRL_RESETTING )
Can you align this a little nicer:
if (dev->ctrl.state == NVME_CTRL_LIVE || dev->ctrl.state == NVME_CTRL_RESETTING)
Otherwise this looks fine:
Maybe Jens should pick this up directly for the block tree? No point in a nvme pull request just for this.
Jens Axboe
maintainerPATCH 1/1 nvme/pci: Fix stuck nvme reset
Quoted 17 lines · Christoph Hellwig
Quoted 4 lines · Keith Busch
The controller state is set to resetting prior to disabling the controller, so this patch accounts for that state when deciding if it needs to freeze the queues. Without this, an 'nvme reset
/dev/nvme0' blocks forever because the queues were never frozen.Ouch.
drivers/nvme/host/pci.c static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown) · line 1809
Quoted 3 lines
drivers/nvme/host/pci.c +2
-1-if (dev->ctrl.state ==NVME_CTRL_LIVE ) +if (dev->ctrl.state ==NVME_CTRL_LIVE || + dev->ctrl.state ==NVME_CTRL_RESETTING )Can you align this a little nicer:
if (dev->ctrl.state == NVME_CTRL_LIVE || dev->ctrl.state == NVME_CTRL_RESETTING)
Quoted 6 lines
Otherwise this looks fine:
Reviewed-by Christoph Hellwig <hch at lst.de>Maybe Jens should pick this up directly for the block tree? No point in a nvme pull request just for this.
Looks good to me too. As it so happens, I just hit this today, but didn't have time to look into why. I'll add it for this series.
Signature · 1 line
Jens Axboe
Sagi Grimberg
maintainerPATCH 1/1 nvme/pci: Fix stuck nvme reset
In reply to Christoph HellwigQuoted 9 lines
Can you align this a little nicer:
if (dev->ctrl.state == NVME_CTRL_LIVE || dev->ctrl.state == NVME_CTRL_RESETTING)Otherwise this looks fine:
Reviewed-by Christoph Hellwig <hch at lst.de>
Same here,