From: jianchao.w.wang@oracle.com (Jianchao Wang)
Subject: [PATCH V2] nvme-pci: set cq_vector to -1 if io queue setup fails
Date: Thu, 15 Feb 2018 19:13:41 +0800 [thread overview]
Message-ID: <1518693221-2430-1-git-send-email-jianchao.w.wang@oracle.com> (raw)
nvme cq irq is freed based on queue_count. When the sq/cq creation
fails, irq will not be setup. free_irq will warn 'Try to free
already-free irq'.
To fix it, set the nvmeq->cq_vector to -1, then nvme_suspend_queue
will ignore it.
Change log:
V1 -> V2
- Follow Keith's suggestion, just set cq_vector to -1 if io queue setup
fails.
- Change patch name and comment
Signed-off-by: Jianchao Wang <jianchao.w.wang at oracle.com>
---
drivers/nvme/host/pci.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 4a7c420..f4528ef 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1452,7 +1452,7 @@ static int nvme_create_queue(struct nvme_queue *nvmeq, int qid)
nvmeq->cq_vector = qid - 1;
result = adapter_alloc_cq(dev, qid, nvmeq);
if (result < 0)
- return result;
+ goto clean_cq_vector;
result = adapter_alloc_sq(dev, qid, nvmeq);
if (result < 0)
@@ -1461,14 +1461,17 @@ static int nvme_create_queue(struct nvme_queue *nvmeq, int qid)
nvme_init_queue(nvmeq, qid);
result = queue_request_irq(nvmeq);
if (result < 0)
- goto release_sq;
+ goto offline;
return result;
- release_sq:
+offline:
+ dev->online_queues--;
adapter_delete_sq(dev, qid);
- release_cq:
+release_cq:
adapter_delete_cq(dev, qid);
+clean_cq_vector:
+ nvmeq->cq_vector = -1;
return result;
}
--
2.7.4
next reply other threads:[~2018-02-15 11:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-15 11:13 Jianchao Wang [this message]
2018-02-24 9:04 ` [PATCH V2] nvme-pci: set cq_vector to -1 if io queue setup fails jianchao.wang
2018-02-26 15:58 ` Keith Busch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1518693221-2430-1-git-send-email-jianchao.w.wang@oracle.com \
--to=jianchao.w.wang@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).