From: keith.busch@intel.com (Keith Busch)
Subject: [PATCH 1/2] NVMe: Lock out shutdown during pci init
Date: Thu, 11 Feb 2016 16:00:25 -0700 [thread overview]
Message-ID: <1455231626-7166-1-git-send-email-keith.busch@intel.com> (raw)
An unexpected driver unbind needs to be prevented from unmapping the
pci nvme registers while they're being initialized.
Signed-off-by: Keith Busch <keith.busch at intel.com>
---
drivers/nvme/host/pci.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 1b0e447..24a7972 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1927,13 +1927,19 @@ static void nvme_reset_work(struct work_struct *work)
set_bit(NVME_CTRL_RESETTING, &dev->flags);
+ /*
+ * Lock out shutdown so an unexpected driver removal won't unmap
+ * registers while reset work is setting them up.
+ */
+ mutex_lock(&dev->shutdown_lock);
result = nvme_dev_map(dev);
if (result)
- goto out;
+ goto out_unlock;
result = nvme_configure_admin_queue(dev);
if (result)
- goto out;
+ goto out_unlock;
+ mutex_unlock(&dev->shutdown_lock);
nvme_init_queue(dev->queues[0], 0);
result = nvme_alloc_admin_tags(dev);
@@ -1970,6 +1976,8 @@ static void nvme_reset_work(struct work_struct *work)
clear_bit(NVME_CTRL_RESETTING, &dev->flags);
return;
+ out_unlock:
+ mutex_unlock(&dev->shutdown_lock);
out:
nvme_remove_dead_ctrl(dev, result);
}
--
2.6.2.307.g37023ba
next 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 Keith Busch [this message]
2016-02-11 23:00 ` [PATCH 2/2] NVMe: NULL pointer check for admin queues Keith Busch
2016-02-13 9:59 ` 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-1-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.