From: minwoo.im.dev@gmail.com (Minwoo Im)
Subject: [PATCH V7 6/7] fabrics: return error when discovery retry exhausted
Date: Tue, 18 Jun 2019 22:12:15 +0900 [thread overview]
Message-ID: <20190618131216.3661-7-minwoo.im.dev@gmail.com> (raw)
In-Reply-To: <20190618131216.3661-1-minwoo.im.dev@gmail.com>
If the discovery page is not updated to the latest one over the 10
times, it's currently returning DISC_OK if the numrec has no problem.
If so, the caller might think that the discovery has been successfully
done without any errors even there is.
This patch makes it return an error -EAGAIN if retry(10 times) has been
exhausted.
Cc: Sagi Grimberg <sagi at grimberg.me>
Signed-off-by: Minwoo Im <minwoo.im.dev at gmail.com>
---
fabrics.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/fabrics.c b/fabrics.c
index adedca0..8470d97 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -291,6 +291,7 @@ enum {
DISC_NO_LOG,
DISC_GET_NUMRECS,
DISC_GET_LOG,
+ DISC_RETRY_EXHAUSTED,
DISC_NOT_EQUAL,
};
@@ -385,6 +386,16 @@ static int nvmf_get_log_page_discovery(const char *dev_path,
} while (genctr != le64_to_cpu(log->genctr) &&
++retries < max_retries);
+ /*
+ * If genctr is still different with the one in the log entry, it
+ * means the retires have been exhausted to max_retries. Then it
+ * should be retried by the caller or the user.
+ */
+ if (genctr != le64_to_cpu(log->genctr)) {
+ error = DISC_RETRY_EXHAUSTED;
+ goto out_free_log;
+ }
+
if (*numrec != le32_to_cpu(log->numrec)) {
error = DISC_NOT_EQUAL;
goto out_free_log;
@@ -882,6 +893,10 @@ static int do_discover(char *argstr, bool connect)
fprintf(stdout, "No discovery log entries to fetch.\n");
ret = DISC_OK;
break;
+ case DISC_RETRY_EXHAUSTED:
+ fprintf(stdout, "Discovery retries exhausted.\n");
+ ret = -EAGAIN;
+ break;
case DISC_NOT_EQUAL:
fprintf(stderr,
"Numrec values of last two get discovery log page not equal\n");
--
2.21.0
next prev parent reply other threads:[~2019-06-18 13:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-18 13:12 [PATCH V7 0/7] nvme-cli: Introduce nvme-status mapping with errno Minwoo Im
2019-06-18 13:12 ` [PATCH V7 1/7] nvme: Do not return in the middle of the subcommand Minwoo Im
2019-06-18 13:12 ` [PATCH V7 2/7] fabrics: " Minwoo Im
2019-06-18 13:12 ` [PATCH V7 3/7] nvme: Return negative error value for internal errors Minwoo Im
2019-06-18 13:12 ` [PATCH V7 4/7] nvme-status: Introduce nvme status module to map errno Minwoo Im
2019-06-18 13:12 ` [PATCH V7 5/7] nvme: Return errno mapped for nvme error status Minwoo Im
2019-06-18 13:12 ` Minwoo Im [this message]
2019-06-18 13:12 ` [PATCH V7 7/7] fabrics: Return errno mapped for fabrics " Minwoo Im
2019-06-19 17:01 ` [PATCH V7 0/7] nvme-cli: Introduce nvme-status mapping with errno Sagi Grimberg
2019-06-19 17:05 ` Chaitanya Kulkarni
2019-06-20 14:22 ` Minwoo Im
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=20190618131216.3661-7-minwoo.im.dev@gmail.com \
--to=minwoo.im.dev@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 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.