Commit ded45505 authored by Keith Busch's avatar Keith Busch Committed by Jens Axboe

nvme-pci: queue creation fixes

We've been ignoring NVMe error status on queue creations. Fortunately they
are uncommon, but we should handle these anyway. This patch adds checks
for the a positive error return value that indicates an NVMe status.

If we do see a negative return, the controller isn't usable, so this
patch returns immediately in since we can't unwind that failure.
Signed-off-by: Keith Busch's avatarKeith Busch <keith.busch@intel.com>
Reviewed-by: default avatarJens Axboe <axboe@kernel.dk>
Reviewed-by: Sagi Grimberg's avatarSagi Grimberg <sagi@grimberg.me>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 397c699f
......@@ -1475,11 +1475,13 @@ static int nvme_create_queue(struct nvme_queue *nvmeq, int qid)
*/
vector = dev->num_vecs == 1 ? 0 : qid;
result = adapter_alloc_cq(dev, qid, nvmeq, vector);
if (result < 0)
goto out;
if (result)
return result;
result = adapter_alloc_sq(dev, qid, nvmeq);
if (result < 0)
return result;
else if (result)
goto release_cq;
/*
......@@ -1501,7 +1503,6 @@ static int nvme_create_queue(struct nvme_queue *nvmeq, int qid)
adapter_delete_sq(dev, qid);
release_cq:
adapter_delete_cq(dev, qid);
out:
return result;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment