From: keith.busch@intel.com (Keith Busch)
Subject: [PATCH 5/8] NVMe: End queued bio requests for removed disks
Date: Wed, 20 Feb 2013 16:52:42 -0700 [thread overview]
Message-ID: <1361404365-18982-5-git-send-email-keith.busch@intel.com> (raw)
In-Reply-To: <1361404365-18982-1-git-send-email-keith.busch@intel.com>
Bio requests queued in the driver should not submit the request to disks
being deleted. This patch checks if the disk is up before submitting and
lets the kthread run on a device being removed until after the namespaces
have been cleared so that the bio's can be ended.
Signed-off-by: Keith Busch <keith.busch at intel.com>
---
drivers/block/nvme.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/block/nvme.c b/drivers/block/nvme.c
index aeaea1a..199c182 100644
--- a/drivers/block/nvme.c
+++ b/drivers/block/nvme.c
@@ -1308,6 +1308,10 @@ static void nvme_resubmit_bios(struct nvme_queue *nvmeq)
while (bio_list_peek(list)) {
struct bio *bio = bio_list_pop(list);
struct nvme_ns *ns = bio->bi_bdev->bd_disk->private_data;
+ if (!(bio->bi_bdev->bd_disk->flags & GENHD_FL_UP)) {
+ bio_endio(bio, -EIO);
+ continue;
+ }
if (nvme_submit_bio_queue(nvmeq, ns, bio)) {
bio_list_add_head(list, bio);
break;
@@ -1592,16 +1596,16 @@ static int nvme_dev_remove(struct nvme_dev *dev)
{
struct nvme_ns *ns, *next;
- spin_lock(&dev_list_lock);
- list_del(&dev->node);
- spin_unlock(&dev_list_lock);
-
list_for_each_entry_safe(ns, next, &dev->namespaces, list) {
list_del(&ns->list);
del_gendisk(ns->disk);
nvme_ns_free(ns);
}
+ spin_lock(&dev_list_lock);
+ list_del(&dev->node);
+ spin_unlock(&dev_list_lock);
+
nvme_free_queues(dev);
return 0;
--
1.7.0.4
next prev parent reply other threads:[~2013-02-20 23:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-20 23:52 [PATCH 1/8] NVMe: Queue bio requests on device Keith Busch
2013-02-20 23:52 ` [PATCH 2/8] NVMe: Controller reset from user Keith Busch
2013-02-26 14:04 ` Matthew Wilcox
2013-03-11 17:02 ` Keith Busch
2013-02-20 23:52 ` [PATCH 3/8] NVMe: Suspend/resume power management Keith Busch
2013-02-20 23:52 ` [PATCH 4/8] NVMe: Add shutdown callback Keith Busch
2013-02-20 23:52 ` Keith Busch [this message]
2013-02-20 23:52 ` [PATCH 6/8] NVMe: Wait for controller status ready to clear Keith Busch
2013-02-20 23:52 ` [PATCH 7/8] NVMe: Automatically reset failed controller Keith Busch
2013-02-20 23:52 ` [PATCH 8/8] NVMe: Use schedule_timeout for sync commands 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=1361404365-18982-5-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.