NVMe: Skip orderly shutdown on failed devices
Subsystems (2)
PATCH 1/1 NVMe: Skip orderly shutdown on failed devices
Rather than skipping shutdown only for device's that have been removed, skip the orderly shutdown on failed devices to avoid the long timeout handling that inevitably happens when deleting queues on such a device.
--- drivers/block/nvme-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/nvme-core.c +1 -1
@@ -2525,7 +2525,7 @@ static void nvme_dev_shutdown(struct nvme_dev *dev) dev->initialized =0 ;nvme_dev_list_remove (dev); -if (!dev->bar || (dev->bar &&readl (&dev->bar->csts) ==-1 )) { +if (!dev->bar || (dev->bar &&readl (&dev->bar->csts) &NVME_CSTS_CFS )) {for (i = dev->queue_count -1 ; i >=0 ; i--) {struct nvme_queue *nvmeq =raw_nvmeq (dev, i);nvme_suspend_queue (nvmeq);
Signature · 1 line
1.7.10.4
PATCH 1/1 NVMe: Skip orderly shutdown on failed devices
Quoted 3 lines · Keith Busch
Rather than skipping shutdown only for device's that have been removed, skip the orderly shutdown on failed devices to avoid the long timeout handling that inevitably happens when deleting queues on such a device.
How about this instead?
@@ -2500,11 +2500,14 @@ static void nvme_dev_list_remove(struct nvme_dev *dev)
static void nvme_dev_shutdown(struct nvme_dev *dev)
{
int i;+ u32 csts = -1;
dev->initialized = 0;
nvme_dev_list_remove(dev);+ if (dev->bar)
+ csts = readl(&dev->bar->csts);
- if (!dev->bar || (dev->bar && readl(&dev->bar->csts) == -1)) {
+ if (csts & NVME_CSTS_CFS) {
for (i = dev->queue_count - 1; i >= 0; i--) {
struct nvme_queue *nvmeq = raw_nvmeq(dev, i);
nvme_suspend_queue(nvmeq);PATCH 1/1 NVMe: Skip orderly shutdown on failed devices
Quoted 6 lines · Matthew Wilcox
Quoted 3 lines · Keith Busch
Rather than skipping shutdown only for device's that have been removed, skip the orderly shutdown on failed devices to avoid the long timeout handling that inevitably happens when deleting queues on such a device.
How about this instead?
Yes, that's much better.
I also just encountered a device that dropped the ready bit. I'm not sure why, but the device definitely wasn't ready to do anything, so I can add the check and skip shutdown there as well.
Quoted 16 lines
(quoted diff) +4
-1@@ -2500,11 +2500,14 @@ static void nvme_dev_list_remove(struct nvme_dev *dev) static void nvme_dev_shutdown(struct nvme_dev *dev) { int i; + u32 csts = -1; dev->initialized = 0; nvme_dev_list_remove(dev); + if (dev->bar) + csts = readl(&dev->bar->csts); - if (!dev->bar || (dev->bar && readl(&dev->bar->csts) == -1)) { + if (csts & NVME_CSTS_CFS) { for (i = dev->queue_count - 1; i >= 0; i--) { struct nvme_queue *nvmeq = raw_nvmeq(dev, i); nvme_suspend_queue(nvmeq);