NVMe: Freeze admin queue on device failure
authorKeith Busch <keith.busch@intel.com>
Thu, 26 Mar 2015 19:49:33 +0000 (13:49 -0600)
committerJens Axboe <axboe@fb.com>
Tue, 31 Mar 2015 16:36:06 +0000 (10:36 -0600)
This fixes a race accessing an invalid address when a controller's admin
queue is in use during a reset for failure or hot removal occurs. The
admin queue will be frozen to prevent new users from entering prior to
the doorbell queue being unmapped.

Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/block/nvme-core.c

index ceb32dd52a6ca5a777e97541646866985251a9f0..ee83554c28ba39032dc01eb11c07a564615ed46c 100644 (file)
@@ -1347,6 +1347,9 @@ static int nvme_suspend_queue(struct nvme_queue *nvmeq)
        nvmeq->cq_vector = -1;
        spin_unlock_irq(&nvmeq->q_lock);
 
+       if (!nvmeq->qid && nvmeq->dev->admin_q)
+               blk_mq_freeze_queue_start(nvmeq->dev->admin_q);
+
        irq_set_affinity_hint(vector, NULL);
        free_irq(vector, nvmeq);
 
@@ -1378,8 +1381,6 @@ static void nvme_disable_queue(struct nvme_dev *dev, int qid)
                adapter_delete_sq(dev, qid);
                adapter_delete_cq(dev, qid);
        }
-       if (!qid && dev->admin_q)
-               blk_mq_freeze_queue_start(dev->admin_q);
 
        spin_lock_irq(&nvmeq->q_lock);
        nvme_process_cq(nvmeq);