]> Pileus Git - ~andy/linux/commitdiff
NVMe: Let the kthread take care of devices earlier
authorMatthew Wilcox <matthew.r.wilcox@intel.com>
Tue, 15 Feb 2011 21:28:20 +0000 (16:28 -0500)
committerMatthew Wilcox <matthew.r.wilcox@intel.com>
Fri, 4 Nov 2011 19:52:58 +0000 (15:52 -0400)
If interrupts are misconfigured, the kthread will be needed to process
admin queue completions.

Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
drivers/block/nvme.c

index f3aa8097e675930ef4ebdcd4892c9fc8939f442c..df1d8bda8c7c0fa6f3fcec48f44fc7dc2ea41129 100644 (file)
@@ -1112,6 +1112,8 @@ static int nvme_kthread(void *data)
                        int i;
                        for (i = 0; i < dev->queue_count; i++) {
                                struct nvme_queue *nvmeq = dev->queues[i];
+                               if (!nvmeq)
+                                       continue;
                                spin_lock_irq(&nvmeq->q_lock);
                                if (nvme_process_cq(nvmeq))
                                        printk("process_cq did something\n");
@@ -1437,17 +1439,21 @@ static int __devinit nvme_probe(struct pci_dev *pdev,
                goto unmap;
        dev->queue_count++;
 
-       result = nvme_dev_add(dev);
-       if (result)
-               goto delete;
-
        spin_lock(&dev_list_lock);
        list_add(&dev->node, &dev_list);
        spin_unlock(&dev_list_lock);
 
+       result = nvme_dev_add(dev);
+       if (result)
+               goto delete;
+
        return 0;
 
  delete:
+       spin_lock(&dev_list_lock);
+       list_del(&dev->node);
+       spin_unlock(&dev_list_lock);
+
        nvme_free_queues(dev);
  unmap:
        iounmap(dev->bar);