aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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)
2189 kfree(ns); 2189 kfree(ns);
2190} 2190}
2191 2191
2192/*
2193 * Create I/O queues. Failing to create an I/O queue is not an issue,
2194 * we can continue with less than the desired amount of queues, and
2195 * even a controller without I/O queues an still be used to issue
2196 * admin commands. This might be useful to upgrade a buggy firmware
2197 * for example.
2198 */
2192static void nvme_create_io_queues(struct nvme_dev *dev) 2199static void nvme_create_io_queues(struct nvme_dev *dev)
2193{ 2200{
2194 unsigned i; 2201 unsigned i;
@@ -2198,8 +2205,10 @@ static void nvme_create_io_queues(struct nvme_dev *dev)
2198 break; 2205 break;
2199 2206
2200 for (i = dev->online_queues; i <= dev->queue_count - 1; i++) 2207 for (i = dev->online_queues; i <= dev->queue_count - 1; i++)
2201 if (nvme_create_queue(dev->queues[i], i)) 2208 if (nvme_create_queue(dev->queues[i], i)) {
2209 nvme_free_queues(dev, i);
2202 break; 2210 break;
2211 }
2203} 2212}
2204 2213
2205static int set_queue_count(struct nvme_dev *dev, int count) 2214static int set_queue_count(struct nvme_dev *dev, int count)
@@ -2994,9 +3003,12 @@ static void nvme_probe_work(struct work_struct *work)
2994 3003
2995 dev->event_limit = 1; 3004 dev->event_limit = 1;
2996 3005
3006 /*
3007 * Keep the controller around but remove all namespaces if we don't have
3008 * any working I/O queue.
3009 */
2997 if (dev->online_queues < 2) { 3010 if (dev->online_queues < 2) {
2998 dev_warn(dev->dev, "IO queues not created\n"); 3011 dev_warn(dev->dev, "IO queues not created\n");
2999 nvme_free_queues(dev, 1);
3000 nvme_dev_remove(dev); 3012 nvme_dev_remove(dev);
3001 } else { 3013 } else {
3002 nvme_unfreeze_queues(dev); 3014 nvme_unfreeze_queues(dev);