From: keith.busch@linux.intel.com (Keith Busch)
Subject: [PATCH 1/1] nvme: Ensure forward progress during Admin passthru
Date: Wed, 27 Jun 2018 14:27:41 -0600 [thread overview]
Message-ID: <20180627202741.GF9361@localhost.localdomain> (raw)
In-Reply-To: <20180627190137.GA9697@sbauer-Z170X-UD5>
On Wed, Jun 27, 2018@01:01:38PM -0600, Scott Bauer wrote:
> On Wed, Jun 27, 2018@01:12:42PM -0600, Keith Busch wrote:
> > How about changing the reaction based on success?
>
> I don't think this will work. The other scenario is the original admin command
> was fine. We enter nvme_update_formats, grab the semaphore as write, issue the
> nvme admin identify, that fails, we enter timeout, and attempt to down_read in
> diasble_dev -> stop queues and get stuck there.
>
> We need a way where we are not holding a down_write on the semaphore while issuing
> I/O.
Oh right ... Maybe the down_write is a bad idea and we should instead
do something like how nvme_kill_queues works? What do you think of the
following?
---
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 46df030..596ea60 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1152,18 +1152,16 @@ static u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
static void nvme_update_formats(struct nvme_ctrl *ctrl)
{
struct nvme_ns *ns, *next;
- LIST_HEAD(rm_list);
- down_write(&ctrl->namespaces_rwsem);
+ down_read(&ctrl->namespaces_rwsem);
list_for_each_entry(ns, &ctrl->namespaces, list) {
- if (ns->disk && nvme_revalidate_disk(ns->disk)) {
- list_move_tail(&ns->list, &rm_list);
- }
+ if (ns->disk && nvme_revalidate_disk(ns->disk))
+ if (test_bit(NVME_NS_DEAD, &ns->flags))
+ set_capacity(disk, 0);
}
- up_write(&ctrl->namespaces_rwsem);
+ up_read(&ctrl->namespaces_rwsem);
- list_for_each_entry_safe(ns, next, &rm_list, list)
- nvme_ns_remove(ns);
+ nvme_remove_invalid_namespaces(ctrl, NVME_NSID_ALL);
}
static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects)
@@ -3138,7 +3136,7 @@ static void nvme_remove_invalid_namespaces(struct nvme_ctrl *ctrl,
down_write(&ctrl->namespaces_rwsem);
list_for_each_entry_safe(ns, next, &ctrl->namespaces, list) {
- if (ns->head->ns_id > nsid)
+ if (ns->head->ns_id > nsid || test_bit(NVME_NS_DEAD, &ns->flags))
list_move_tail(&ns->list, &rm_list);
}
up_write(&ctrl->namespaces_rwsem);
--
next prev parent reply other threads:[~2018-06-27 20:27 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-22 19:59 [PATCH 0/1] nvme: Ensure forward progress during Admin passthru Scott Bauer
2018-06-22 19:59 ` [PATCH 1/1] " Scott Bauer
2018-06-27 19:12 ` Keith Busch
2018-06-27 19:01 ` Scott Bauer
2018-06-27 20:27 ` Keith Busch [this message]
2018-06-27 20:49 ` Keith Busch
2018-06-24 17:38 ` [PATCH 0/1] " Sagi Grimberg
2018-06-27 19:08 ` Keith Busch
2018-06-28 17:10 ` [PATCH v2 1/1] " Scott Bauer
2018-06-28 19:16 ` Keith Busch
2018-06-28 19:19 ` Scott Bauer
2018-06-28 19:54 ` Keith Busch
2018-06-29 19:03 ` [PATCH v3 " Scott Bauer
2018-06-29 20:23 ` Keith Busch
2018-07-16 22:09 ` Keith Busch
2018-07-17 12:42 ` Christoph Hellwig
2018-07-18 11:26 ` Sagi Grimberg
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=20180627202741.GF9361@localhost.localdomain \
--to=keith.busch@linux.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).