From: jsmart2021@gmail.com (James Smart)
Subject: [PATCH] nvme: continue keep alive on error
Date: Wed, 9 May 2018 14:25:43 -0700 [thread overview]
Message-ID: <20180509212543.5169-1-jsmart2021@gmail.com> (raw)
Currently, if the keep_alive command failed, an error message is
generated and keep alive is stopped. This guarantees the target will
eventually not see a keep_alive in a KATO window and fail.
The keep_alive command may complete in error in cases where the
transport or lldd are temporarily out of resources. As such, the
command should be retried rather than letting the controller die.
If the command completes in error, retry another one after a short
delay.
Signed-off-by: James Smart <james.smart at broadcom.com>
---
drivers/nvme/host/core.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index f3779f350769..6f1b2502fc1c 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -791,17 +791,18 @@ static int nvme_submit_user_cmd(struct request_queue *q,
static void nvme_keep_alive_end_io(struct request *rq, blk_status_t status)
{
struct nvme_ctrl *ctrl = rq->end_io_data;
+ unsigned long delay = ctrl->kato * HZ;
blk_mq_free_request(rq);
if (status) {
- dev_err(ctrl->device,
- "failed nvme_keep_alive_end_io error=%d\n",
+ dev_info(ctrl->device,
+ "failed nvme_keep_alive_end_io error=%d, retrying\n",
status);
- return;
+ delay = (HZ / 4); /* 250ms */
}
- schedule_delayed_work(&ctrl->ka_work, ctrl->kato * HZ);
+ schedule_delayed_work(&ctrl->ka_work, delay);
}
static int nvme_keep_alive(struct nvme_ctrl *ctrl)
--
2.13.1
reply other threads:[~2018-05-09 21:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20180509212543.5169-1-jsmart2021@gmail.com \
--to=jsmart2021@gmail.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).