From: keith.busch@intel.com (Keith Busch)
Subject: [PATCH 2/2] NVMe: NULL pointer check for admin queues
Date: Thu, 11 Feb 2016 16:00:26 -0700 [thread overview]
Message-ID: <1455231626-7166-2-git-send-email-keith.busch@intel.com> (raw)
In-Reply-To: <1455231626-7166-1-git-send-email-keith.busch@intel.com>
Admin commands don't have a namespace, so don't check the state when
there isn't one.
An admin command that does happen to make it to a disabled queue can
failed immediatly: Initialization commands should not be requeued
across resets as they would mess up the controller if/when it is
reinitialized. If a user command made hits this condition, it should
be able to handle this error as that's the existing result for commands
when the controller is reset with outstanding admin commands.
Signed-off-by: Keith Busch <keith.busch at intel.com>
---
drivers/nvme/host/pci.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 24a7972..44ccd23 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -678,7 +678,12 @@ static int nvme_queue_rq(struct blk_mq_hw_ctx *hctx,
spin_lock_irq(&nvmeq->q_lock);
if (unlikely(nvmeq->cq_vector < 0)) {
- ret = test_bit(NVME_NS_DEAD, &ns->flags) ?
+ /*
+ * Admin commands need to fail immediatly when device is
+ * disabled: initialization commands should not requeue
+ * across resets.
+ */
+ ret = !ns || test_bit(NVME_NS_DEAD, &ns->flags) ?
BLK_MQ_RQ_QUEUE_ERROR :
BLK_MQ_RQ_QUEUE_BUSY;
spin_unlock_irq(&nvmeq->q_lock);
--
2.6.2.307.g37023ba
next prev parent reply other threads:[~2016-02-11 23:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-11 23:00 [PATCH 1/2] NVMe: Lock out shutdown during pci init Keith Busch
2016-02-11 23:00 ` Keith Busch [this message]
2016-02-13 9:59 ` [PATCH 2/2] NVMe: NULL pointer check for admin queues Christoph Hellwig
2016-02-22 8:44 ` Sagi Grimberg
2016-02-13 9:58 ` [PATCH 1/2] NVMe: Lock out shutdown during pci init Christoph Hellwig
2016-02-16 18:40 ` Keith Busch
2016-02-17 7:59 ` Christoph Hellwig
2016-02-17 13:40 ` 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=1455231626-7166-2-git-send-email-keith.busch@intel.com \
--to=keith.busch@intel.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).