summaryrefslogtreecommitdiff
path: root/drivers/block
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2015-10-02 18:51:31 +0200
committerJens Axboe <axboe@fb.com>2015-10-09 10:40:37 -0600
commit2659e57b906562bb020fb093b0c1b670b9700314 (patch)
tree12981104cda91f51ceed57206887e80e0246975b /drivers/block
parent3cf519b5a8d4d067e3de19736283c9414402d3a2 (diff)
nvme: properly handle partially initialized queues in nvme_create_io_queues
This avoids having to clean up later in a seemingly unrelated place. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Keith Busch <keith.busch@intel.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/nvme-core.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index 61cfff34c3b8..01a6d1b2d7e5 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -2189,6 +2189,13 @@ static void nvme_alloc_ns(struct nvme_dev *dev, unsigned nsid)
kfree(ns);
}
+/*
+ * Create I/O queues. Failing to create an I/O queue is not an issue,
+ * we can continue with less than the desired amount of queues, and
+ * even a controller without I/O queues an still be used to issue
+ * admin commands. This might be useful to upgrade a buggy firmware
+ * for example.
+ */
static void nvme_create_io_queues(struct nvme_dev *dev)
{
unsigned i;
@@ -2198,8 +2205,10 @@ static void nvme_create_io_queues(struct nvme_dev *dev)
break;
for (i = dev->online_queues; i <= dev->queue_count - 1; i++)
- if (nvme_create_queue(dev->queues[i], i))
+ if (nvme_create_queue(dev->queues[i], i)) {
+ nvme_free_queues(dev, i);
break;
+ }
}
static int set_queue_count(struct nvme_dev *dev, int count)
@@ -2994,9 +3003,12 @@ static void nvme_probe_work(struct work_struct *work)
dev->event_limit = 1;
+ /*
+ * Keep the controller around but remove all namespaces if we don't have
+ * any working I/O queue.
+ */
if (dev->online_queues < 2) {
dev_warn(dev->dev, "IO queues not created\n");
- nvme_free_queues(dev, 1);
nvme_dev_remove(dev);
} else {
nvme_unfreeze_queues(dev);