From: keith.busch@intel.com (Keith Busch)
Subject: [PATCH 2/2] NVMe: Synchronize resets with scan work
Date: Tue, 31 May 2016 13:49:08 -0600 [thread overview]
Message-ID: <1464724148-11169-2-git-send-email-keith.busch@intel.com> (raw)
In-Reply-To: <1464724148-11169-1-git-send-email-keith.busch@intel.com>
A user could continuously reset a controller, which aborts active
commands. If the controller is currently scanning live namespaces, the
aborted commands could cause namespaces to fail. This patch synchronizes
the reset on a live controller with namespace scanning work to prevent
this from occuring.
Reported-by: Ming Lin <mlin at kernel.org>
Signed-off-by: Keith Busch <keith.busch at intel.com>
---
drivers/nvme/host/pci.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index dfb8f2a..7c4e194 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1781,10 +1781,13 @@ static void nvme_reset_work(struct work_struct *work)
/*
* If we're called to reset a live controller first shut it down before
- * moving on.
+ * moving on. Synchronize with controller scanning so a user can't
+ * interrupt and fail active namespace validation.
*/
- if (dev->ctrl.ctrl_config & NVME_CC_ENABLE)
+ if (dev->ctrl.ctrl_config & NVME_CC_ENABLE) {
+ flush_work(&dev->ctrl.scan_work);
nvme_dev_disable(dev, false);
+ }
result = nvme_pci_enable(dev);
if (result)
--
2.7.2
next prev parent reply other threads:[~2016-05-31 19:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-31 19:49 [PATCH 1/2] NVMe: Add controller state for scheduling resets Keith Busch
2016-05-31 19:49 ` Keith Busch [this message]
2016-05-31 21:05 ` [PATCH 2/2] NVMe: Synchronize resets with scan work Christoph Hellwig
2016-06-01 7:20 ` Johannes Thumshirn
2016-05-31 21:04 ` [PATCH 1/2] NVMe: Add controller state for scheduling resets Christoph Hellwig
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=1464724148-11169-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