* [PATCH 1/3] NFS: Extend the -overs= mount option to allow 4.x minorversions
@ 2012-03-02 19:04 Trond Myklebust
2012-03-02 19:04 ` [PATCH 2/3] NFS: Ensure we display the minor version correctly in /proc/mounts etc Trond Myklebust
0 siblings, 1 reply; 5+ messages in thread
From: Trond Myklebust @ 2012-03-02 19:04 UTC (permalink / raw)
To: linux-nfs
Allow the user to mount an NFSv4.0 or NFSv4.1 partition using a
standard syntax of '-overs=4.0', or '-overs=4.1' rather than the
more cumbersome '-overs=4,minorversion=1'.
See also the earlier patch by Dros Adamson, which added the
Linux-specific syntax '-ov4.0', '-ov4.1'.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
---
fs/nfs/super.c | 84 +++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 62 insertions(+), 22 deletions(-)
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 8154acc..ab58bb9 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -98,10 +98,10 @@ enum {
Opt_namelen,
Opt_mountport,
Opt_mountvers,
- Opt_nfsvers,
Opt_minorversion,
/* Mount options that take string arguments */
+ Opt_nfsvers,
Opt_sec, Opt_proto, Opt_mountproto, Opt_mounthost,
Opt_addr, Opt_mountaddr, Opt_clientaddr,
Opt_lookupcache,
@@ -166,9 +166,10 @@ static const match_table_t nfs_mount_option_tokens = {
{ Opt_namelen, "namlen=%s" },
{ Opt_mountport, "mountport=%s" },
{ Opt_mountvers, "mountvers=%s" },
+ { Opt_minorversion, "minorversion=%s" },
+
{ Opt_nfsvers, "nfsvers=%s" },
{ Opt_nfsvers, "vers=%s" },
- { Opt_minorversion, "minorversion=%s" },
{ Opt_sec, "sec=%s" },
{ Opt_proto, "proto=%s" },
@@ -262,6 +263,22 @@ static match_table_t nfs_local_lock_tokens = {
{ Opt_local_lock_err, NULL }
};
+enum {
+ Opt_vers_2, Opt_vers_3, Opt_vers_4, Opt_vers_4_0,
+ Opt_vers_4_1,
+
+ Opt_vers_err
+};
+
+static match_table_t nfs_vers_tokens = {
+ { Opt_vers_2, "2" },
+ { Opt_vers_3, "3" },
+ { Opt_vers_4, "4" },
+ { Opt_vers_4_0, "4.0" },
+ { Opt_vers_4_1, "4.1" },
+
+ { Opt_vers_err, NULL }
+};
static void nfs_umount_begin(struct super_block *);
static int nfs_statfs(struct dentry *, struct kstatfs *);
@@ -1064,6 +1081,40 @@ static int nfs_parse_security_flavors(char *value,
return 1;
}
+static int nfs_parse_version_string(char *string,
+ struct nfs_parsed_mount_data *mnt,
+ substring_t *args)
+{
+ mnt->flags &= ~NFS_MOUNT_VER3;
+ switch (match_token(string, nfs_vers_tokens, args)) {
+ case Opt_vers_2:
+ mnt->version = 2;
+ break;
+ case Opt_vers_3:
+ mnt->flags |= NFS_MOUNT_VER3;
+ mnt->version = 3;
+ break;
+ case Opt_vers_4:
+ /* Backward compatibility option. In future,
+ * the mount program should always supply
+ * a NFSv4 minor version number.
+ */
+ mnt->version = 4;
+ break;
+ case Opt_vers_4_0:
+ mnt->version = 4;
+ mnt->minorversion = 0;
+ break;
+ case Opt_vers_4_1:
+ mnt->version = 4;
+ mnt->minorversion = 1;
+ break;
+ default:
+ return 0;
+ }
+ return 1;
+}
+
static int nfs_get_option_str(substring_t args[], char **option)
{
kfree(*option);
@@ -1317,26 +1368,6 @@ static int nfs_parse_mount_options(char *raw,
goto out_invalid_value;
mnt->mount_server.version = option;
break;
- case Opt_nfsvers:
- if (nfs_get_option_ul(args, &option))
- goto out_invalid_value;
- switch (option) {
- case NFS2_VERSION:
- mnt->flags &= ~NFS_MOUNT_VER3;
- mnt->version = 2;
- break;
- case NFS3_VERSION:
- mnt->flags |= NFS_MOUNT_VER3;
- mnt->version = 3;
- break;
- case NFS4_VERSION:
- mnt->flags &= ~NFS_MOUNT_VER3;
- mnt->version = 4;
- break;
- default:
- goto out_invalid_value;
- }
- break;
case Opt_minorversion:
if (nfs_get_option_ul(args, &option))
goto out_invalid_value;
@@ -1348,6 +1379,15 @@ static int nfs_parse_mount_options(char *raw,
/*
* options that take text values
*/
+ case Opt_nfsvers:
+ string = match_strdup(args);
+ if (string == NULL)
+ goto out_nomem;
+ rc = nfs_parse_version_string(string, mnt, args);
+ kfree(string);
+ if (!rc)
+ goto out_invalid_value;
+ break;
case Opt_sec:
string = match_strdup(args);
if (string == NULL)
--
1.7.7.6
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/3] NFS: Ensure we display the minor version correctly in /proc/mounts etc.
2012-03-02 19:04 [PATCH 1/3] NFS: Extend the -overs= mount option to allow 4.x minorversions Trond Myklebust
@ 2012-03-02 19:04 ` Trond Myklebust
2012-03-02 20:46 ` Jim Rees
0 siblings, 1 reply; 5+ messages in thread
From: Trond Myklebust @ 2012-03-02 19:04 UTC (permalink / raw)
To: linux-nfs
The 'minorversion' mount option is now deprecated, so we need to display
the minor version number in the 'vers=' format.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
---
fs/nfs/super.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index ab58bb9..7f0c93f 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -640,7 +640,6 @@ static void nfs_show_nfsv4_options(struct seq_file *m, struct nfs_server *nfss,
struct nfs_client *clp = nfss->nfs_client;
seq_printf(m, ",clientaddr=%s", clp->cl_ipaddr);
- seq_printf(m, ",minorversion=%u", clp->cl_minorversion);
}
#else
static void nfs_show_nfsv4_options(struct seq_file *m, struct nfs_server *nfss,
@@ -649,6 +648,15 @@ static void nfs_show_nfsv4_options(struct seq_file *m, struct nfs_server *nfss,
}
#endif
+static void nfs_show_nfs_version(struct seq_file *m,
+ unsigned int version,
+ unsigned int minorversion)
+{
+ seq_printf(m, ",vers=%u", version);
+ if (version == 4)
+ seq_printf(m, ".%u", minorversion);
+}
+
/*
* Describe the mount options in force on this server representation
*/
@@ -676,7 +684,7 @@ static void nfs_show_mount_options(struct seq_file *m, struct nfs_server *nfss,
u32 version = clp->rpc_ops->version;
int local_flock, local_fcntl;
- seq_printf(m, ",vers=%u", version);
+ nfs_show_nfs_version(m, version, clp->cl_minorversion);
seq_printf(m, ",rsize=%u", nfss->rsize);
seq_printf(m, ",wsize=%u", nfss->wsize);
if (nfss->bsize != 0)
--
1.7.7.6
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 2/3] NFS: Ensure we display the minor version correctly in /proc/mounts etc.
2012-03-02 19:04 ` [PATCH 2/3] NFS: Ensure we display the minor version correctly in /proc/mounts etc Trond Myklebust
@ 2012-03-02 20:46 ` Jim Rees
2012-03-02 20:57 ` Myklebust, Trond
0 siblings, 1 reply; 5+ messages in thread
From: Jim Rees @ 2012-03-02 20:46 UTC (permalink / raw)
To: Trond Myklebust; +Cc: linux-nfs
Trond Myklebust wrote:
The 'minorversion' mount option is now deprecated, so we need to display
the minor version number in the 'vers=' format.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
---
fs/nfs/super.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index ab58bb9..7f0c93f 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -640,7 +640,6 @@ static void nfs_show_nfsv4_options(struct seq_file *m, struct nfs_server *nfss,
struct nfs_client *clp = nfss->nfs_client;
seq_printf(m, ",clientaddr=%s", clp->cl_ipaddr);
- seq_printf(m, ",minorversion=%u", clp->cl_minorversion);
}
#else
static void nfs_show_nfsv4_options(struct seq_file *m, struct nfs_server *nfss,
@@ -649,6 +648,15 @@ static void nfs_show_nfsv4_options(struct seq_file *m, struct nfs_server *nfss,
}
#endif
+static void nfs_show_nfs_version(struct seq_file *m,
+ unsigned int version,
+ unsigned int minorversion)
+{
+ seq_printf(m, ",vers=%u", version);
Isn't "nfsvers=" preferred? That's what the man page implies.
+ if (version == 4)
Should this be "version >= 4"? (only half serious)
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 2/3] NFS: Ensure we display the minor version correctly in /proc/mounts etc.
2012-03-02 20:46 ` Jim Rees
@ 2012-03-02 20:57 ` Myklebust, Trond
0 siblings, 0 replies; 5+ messages in thread
From: Myklebust, Trond @ 2012-03-02 20:57 UTC (permalink / raw)
To: Jim Rees; +Cc: linux-nfs@vger.kernel.org
T24gRnJpLCAyMDEyLTAzLTAyIGF0IDE1OjQ2IC0wNTAwLCBKaW0gUmVlcyB3cm90ZToNCj4gVHJv
bmQgTXlrbGVidXN0IHdyb3RlOg0KPiANCj4gICBUaGUgJ21pbm9ydmVyc2lvbicgbW91bnQgb3B0
aW9uIGlzIG5vdyBkZXByZWNhdGVkLCBzbyB3ZSBuZWVkIHRvIGRpc3BsYXkNCj4gICB0aGUgbWlu
b3IgdmVyc2lvbiBudW1iZXIgaW4gdGhlICd2ZXJzPScgZm9ybWF0Lg0KPiAgIA0KPiAgIFNpZ25l
ZC1vZmYtYnk6IFRyb25kIE15a2xlYnVzdCA8VHJvbmQuTXlrbGVidXN0QG5ldGFwcC5jb20+DQo+
ICAgLS0tDQo+ICAgIGZzL25mcy9zdXBlci5jIHwgICAxMiArKysrKysrKysrLS0NCj4gICAgMSBm
aWxlcyBjaGFuZ2VkLCAxMCBpbnNlcnRpb25zKCspLCAyIGRlbGV0aW9ucygtKQ0KPiAgIA0KPiAg
IGRpZmYgLS1naXQgYS9mcy9uZnMvc3VwZXIuYyBiL2ZzL25mcy9zdXBlci5jDQo+ICAgaW5kZXgg
YWI1OGJiOS4uN2YwYzkzZiAxMDA2NDQNCj4gICAtLS0gYS9mcy9uZnMvc3VwZXIuYw0KPiAgICsr
KyBiL2ZzL25mcy9zdXBlci5jDQo+ICAgQEAgLTY0MCw3ICs2NDAsNiBAQCBzdGF0aWMgdm9pZCBu
ZnNfc2hvd19uZnN2NF9vcHRpb25zKHN0cnVjdCBzZXFfZmlsZSAqbSwgc3RydWN0IG5mc19zZXJ2
ZXIgKm5mc3MsDQo+ICA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o+ICAgKwlpZiAodmVyc2lvbiA9PSA0KQ0KPiANCj4gU2hvdWxkIHRoaXMgYmUgInZlcnNpb24g
Pj0gNCI/ICAob25seSBoYWxmIHNlcmlvdXMpDQoNCldoaWNoIGNyeXN0YWwgYmFsbCBzaG91bGQg
SSB1c2UgdG8gdmVyaWZ5IHRoYXQ/DQoNCi0tIA0KVHJvbmQgTXlrbGVidXN0DQpMaW51eCBORlMg
Y2xpZW50IG1haW50YWluZXINCg0KTmV0QXBwDQpUcm9uZC5NeWtsZWJ1c3RAbmV0YXBwLmNvbQ0K
d3d3Lm5ldGFwcC5jb20NCg0K
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] NFS: Extend the -overs= mount option to allow 4.x minorversions
@ 2012-03-02 19:07 Trond Myklebust
0 siblings, 0 replies; 5+ messages in thread
From: Trond Myklebust @ 2012-03-02 19:07 UTC (permalink / raw)
To: linux-nfs
Allow the user to mount an NFSv4.0 or NFSv4.1 partition using a
standard syntax of '-overs=4.0', or '-overs=4.1' rather than the
more cumbersome '-overs=4,minorversion=1'.
See also the earlier patch by Dros Adamson, which added the
Linux-specific syntax '-ov4.0', '-ov4.1'.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
---
fs/nfs/super.c | 84 +++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 62 insertions(+), 22 deletions(-)
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 8154acc..ab58bb9 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -98,10 +98,10 @@ enum {
Opt_namelen,
Opt_mountport,
Opt_mountvers,
- Opt_nfsvers,
Opt_minorversion,
/* Mount options that take string arguments */
+ Opt_nfsvers,
Opt_sec, Opt_proto, Opt_mountproto, Opt_mounthost,
Opt_addr, Opt_mountaddr, Opt_clientaddr,
Opt_lookupcache,
@@ -166,9 +166,10 @@ static const match_table_t nfs_mount_option_tokens = {
{ Opt_namelen, "namlen=%s" },
{ Opt_mountport, "mountport=%s" },
{ Opt_mountvers, "mountvers=%s" },
+ { Opt_minorversion, "minorversion=%s" },
+
{ Opt_nfsvers, "nfsvers=%s" },
{ Opt_nfsvers, "vers=%s" },
- { Opt_minorversion, "minorversion=%s" },
{ Opt_sec, "sec=%s" },
{ Opt_proto, "proto=%s" },
@@ -262,6 +263,22 @@ static match_table_t nfs_local_lock_tokens = {
{ Opt_local_lock_err, NULL }
};
+enum {
+ Opt_vers_2, Opt_vers_3, Opt_vers_4, Opt_vers_4_0,
+ Opt_vers_4_1,
+
+ Opt_vers_err
+};
+
+static match_table_t nfs_vers_tokens = {
+ { Opt_vers_2, "2" },
+ { Opt_vers_3, "3" },
+ { Opt_vers_4, "4" },
+ { Opt_vers_4_0, "4.0" },
+ { Opt_vers_4_1, "4.1" },
+
+ { Opt_vers_err, NULL }
+};
static void nfs_umount_begin(struct super_block *);
static int nfs_statfs(struct dentry *, struct kstatfs *);
@@ -1064,6 +1081,40 @@ static int nfs_parse_security_flavors(char *value,
return 1;
}
+static int nfs_parse_version_string(char *string,
+ struct nfs_parsed_mount_data *mnt,
+ substring_t *args)
+{
+ mnt->flags &= ~NFS_MOUNT_VER3;
+ switch (match_token(string, nfs_vers_tokens, args)) {
+ case Opt_vers_2:
+ mnt->version = 2;
+ break;
+ case Opt_vers_3:
+ mnt->flags |= NFS_MOUNT_VER3;
+ mnt->version = 3;
+ break;
+ case Opt_vers_4:
+ /* Backward compatibility option. In future,
+ * the mount program should always supply
+ * a NFSv4 minor version number.
+ */
+ mnt->version = 4;
+ break;
+ case Opt_vers_4_0:
+ mnt->version = 4;
+ mnt->minorversion = 0;
+ break;
+ case Opt_vers_4_1:
+ mnt->version = 4;
+ mnt->minorversion = 1;
+ break;
+ default:
+ return 0;
+ }
+ return 1;
+}
+
static int nfs_get_option_str(substring_t args[], char **option)
{
kfree(*option);
@@ -1317,26 +1368,6 @@ static int nfs_parse_mount_options(char *raw,
goto out_invalid_value;
mnt->mount_server.version = option;
break;
- case Opt_nfsvers:
- if (nfs_get_option_ul(args, &option))
- goto out_invalid_value;
- switch (option) {
- case NFS2_VERSION:
- mnt->flags &= ~NFS_MOUNT_VER3;
- mnt->version = 2;
- break;
- case NFS3_VERSION:
- mnt->flags |= NFS_MOUNT_VER3;
- mnt->version = 3;
- break;
- case NFS4_VERSION:
- mnt->flags &= ~NFS_MOUNT_VER3;
- mnt->version = 4;
- break;
- default:
- goto out_invalid_value;
- }
- break;
case Opt_minorversion:
if (nfs_get_option_ul(args, &option))
goto out_invalid_value;
@@ -1348,6 +1379,15 @@ static int nfs_parse_mount_options(char *raw,
/*
* options that take text values
*/
+ case Opt_nfsvers:
+ string = match_strdup(args);
+ if (string == NULL)
+ goto out_nomem;
+ rc = nfs_parse_version_string(string, mnt, args);
+ kfree(string);
+ if (!rc)
+ goto out_invalid_value;
+ break;
case Opt_sec:
string = match_strdup(args);
if (string == NULL)
--
1.7.7.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-03-02 20:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-02 19:04 [PATCH 1/3] NFS: Extend the -overs= mount option to allow 4.x minorversions Trond Myklebust
2012-03-02 19:04 ` [PATCH 2/3] NFS: Ensure we display the minor version correctly in /proc/mounts etc Trond Myklebust
2012-03-02 20:46 ` Jim Rees
2012-03-02 20:57 ` Myklebust, Trond
-- strict thread matches above, loose matches on Subject: below --
2012-03-02 19:07 [PATCH 1/3] NFS: Extend the -overs= mount option to allow 4.x minorversions Trond Myklebust
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).