From: sagi@grimberg.me (Sagi Grimberg)
Subject: [PATCH v3 7/7] nvme: don't remove namespace if revalidate failed because of a transport error
Date: Thu, 8 Aug 2019 13:53:25 -0700 [thread overview]
Message-ID: <20190808205325.24036-8-sagi@grimberg.me> (raw)
In-Reply-To: <20190808205325.24036-1-sagi@grimberg.me>
If a controller reset is racing with a namespace revalidation, the
revalidation (admin) I/O will surely fail, but we should not remove the
namespace as we will execute the I/O when the controller is back up.
Fix this by checking the specific error code that revalidate_disk
returns, and if it is a transport related error, do not remove
the namespace as it will either recover when the controller is
back up and schedule a subsequent scan, or the controller is
going away and the namespaces will be removed anyways.
This fixes a hang namespace scanning racing with a controller reset and
also sporious I/O errors in path failover coditions where the
controller reset is racing with the namespace scan work with multipath
enabled.
Reported-by: Hannes Reinecke <hare at suse.de>
Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
---
drivers/nvme/host/core.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 49ffccd72091..001bcc8a8d3e 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -228,6 +228,8 @@ static blk_status_t nvme_error_status(struct request *req)
return BLK_STS_PROTECTION;
case NVME_SC_RESERVATION_CONFLICT:
return BLK_STS_NEXUS;
+ case NVME_SC_HOST_PATH_ERROR:
+ return BLK_STS_TRANSPORT;
default:
return BLK_STS_IOERR;
}
@@ -3452,8 +3454,11 @@ static void nvme_validate_ns(struct nvme_ctrl *ctrl, unsigned nsid)
ns = nvme_find_get_ns(ctrl, nsid);
if (ns) {
- if (ns->disk && revalidate_disk(ns->disk))
- nvme_ns_remove(ns);
+ if (ns->disk) {
+ blk_status_t sts = revalidate_disk(ns->disk);
+ if (sts && sts != BLK_STS_TRANSPORT)
+ nvme_ns_remove(ns);
+ }
nvme_put_ns(ns);
} else
nvme_alloc_ns(ctrl, nsid);
--
2.17.1
next prev parent reply other threads:[~2019-08-08 20:53 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-08 20:53 [PATCH v3 0/7] nvme controller reset and namespace scan work race conditions Sagi Grimberg
2019-08-08 20:53 ` [PATCH v3 1/7] nvme: fail cancelled commands with NVME_SC_HOST_PATH_ERROR Sagi Grimberg
2019-08-10 11:59 ` Hannes Reinecke
2019-08-08 20:53 ` [PATCH v3 2/7] nvme: return nvme_error_status for sync commands failure Sagi Grimberg
2019-08-10 12:06 ` Hannes Reinecke
2019-08-08 20:53 ` [PATCH v3 3/7] nvme: make nvme_identify_ns propagate errors back Sagi Grimberg
2019-08-08 21:18 ` Keith Busch
2019-08-08 23:22 ` Sagi Grimberg
2019-08-10 12:09 ` Hannes Reinecke
2019-08-08 20:53 ` [PATCH v3 4/7] nvme: make nvme_report_ns_ids propagate error back Sagi Grimberg
2019-08-10 12:10 ` Hannes Reinecke
2019-08-08 20:53 ` [PATCH v3 5/7] nvme-tcp: fail command with NVME_SC_HOST_PATH_ERROR send failed Sagi Grimberg
2019-08-10 12:10 ` Hannes Reinecke
2019-08-08 20:53 ` [PATCH v3 6/7] nvme-fc: Fail transport errors with NVME_SC_HOST_PATH Sagi Grimberg
2019-08-10 12:11 ` Hannes Reinecke
2019-08-08 20:53 ` Sagi Grimberg [this message]
2019-08-10 12:14 ` [PATCH v3 7/7] nvme: don't remove namespace if revalidate failed because of a transport error Hannes Reinecke
2019-08-11 5:28 ` Sagi Grimberg
2019-08-08 23:26 ` [PATCH v3 0/7] nvme controller reset and namespace scan work race conditions Bart Van Assche
2019-08-08 23:33 ` Sagi Grimberg
2019-08-08 23:57 ` Bart Van Assche
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=20190808205325.24036-8-sagi@grimberg.me \
--to=sagi@grimberg.me \
/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