From: Steve Dickson <steved@redhat.com>
To: Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Subject: [PATCH 1/1] mount.nfs: minorversion setting is being ignored with -t flag
Date: Mon, 26 Feb 2018 14:15:42 -0500 [thread overview]
Message-ID: <20180226191542.31447-2-steved@redhat.com> (raw)
In-Reply-To: <20180226191542.31447-1-steved@redhat.com>
mount -t nfs or mount -t nfs4 and setting minorversion
should set the v4 minor version. This patch adds a few
checks to make sure the minor version is set.
The patch also translate the minorversion= option
to vers=4.x in the arguments passed to the kernel.
Signed-off-by: Steve Dickson <steved@redhat.com>
---
utils/mount/network.c | 15 ++++++++++-----
utils/mount/stropts.c | 14 ++++++++++++++
2 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/utils/mount/network.c b/utils/mount/network.c
index 8ab5be8..8d6e4c6 100644
--- a/utils/mount/network.c
+++ b/utils/mount/network.c
@@ -1275,8 +1275,8 @@ nfs_nfs_version(char *type, struct mount_options *options, struct nfs_version *v
}
}
- if (!found && strcmp(type, "nfs4") == 0)
- version_val = type + 3;
+ if (!found && strncmp(type, "nfs", 3) == 0)
+ version_val = "4";
else if (!found)
return 1;
else if (i <= 2 ) {
@@ -1308,9 +1308,14 @@ nfs_nfs_version(char *type, struct mount_options *options, struct nfs_version *v
if (!(version->minor = strtol(version_val, &cptr, 10)) && cptr == version_val)
goto ret_error;
version->v_mode = V_SPECIFIC;
- } else if (version->major > 3 && *cptr == '\0')
- version->v_mode = V_GENERAL;
-
+ } else if (version->major > 3 && *cptr == '\0') {
+ version_val = po_get(options, "minorversion");
+ if (version_val != NULL) {
+ version->minor = strtol(version_val, &cptr, 10);
+ version->v_mode = V_SPECIFIC;
+ } else
+ version->v_mode = V_GENERAL;
+ }
if (*cptr != '\0')
goto ret_error;
diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index 777de39..6bbfd71 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -767,6 +767,20 @@ static int nfs_do_mount_v4(struct nfsmount_info *mi,
mi->version.minor);
#pragma GCC diagnostic warning "-Wformat-nonliteral"
+ if (po_append(options, version_opt) == PO_FAILED) {
+ errno = EINVAL;
+ goto out_fail;
+ }
+ } else if (po_get(options, "minorversion")) {
+ /*
+ * convert minorversion= into vers=4.x
+ */
+ po_remove_all(options, "minorversion");
+
+ snprintf(version_opt, sizeof(version_opt) - 1,
+ "vers=%lu.%lu", mi->version.major,
+ mi->version.minor);
+
if (po_append(options, version_opt) == PO_FAILED) {
errno = EINVAL;
goto out_fail;
--
2.14.3
next prev parent reply other threads:[~2018-02-26 19:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-26 19:15 [PATCH 0/1] minorversion= is being ignored Steve Dickson
2018-02-26 19:15 ` Steve Dickson [this message]
2018-02-27 2:12 ` [PATCH 1/1] mount.nfs: minorversion setting is being ignored with -t flag NeilBrown
2018-02-27 18:51 ` Steve Dickson
2018-02-27 20:49 ` NeilBrown
2018-02-27 22:00 ` Steve Dickson
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=20180226191542.31447-2-steved@redhat.com \
--to=steved@redhat.com \
--cc=linux-nfs@vger.kernel.org \
/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).