Enable v4 mounts when either "nfsvers=4" or "vers=4" option are set (vers-01)
Subsystems (2)
PATCH 1/1 Enable v4 mounts when either "nfsvers=4" or "vers=4" option are set (vers-01)
Incorporating all the input from the RFC of this patch (thank you very much) here is the actual patch that allows v4 mount to occurr by setting mount version to '4' on the mount command line.
The patch is on the "mount_vers4-r1" branch on my experiential git tree:
git://linux-nfs.org/~steved/nfs-utils-exp.git
Comments?
steved.
commit 8ae2bbb042559cd283067322072b6d669819e729
Author: Steve Dickson <[email protected]> Date: Mon Aug 24 12:06:51 2009 -0400
Enable v4 mounts when either "nfsvers=4" or "vers=4" option are set.
Since nfs4 is a different file system than nfs, the file system type has to be set when "v4" or "vers=4" or "nfsvers=4" are used. So when either of these options are specified, the file system type will be set to "nfs4" and those options will be stripped out of the option list since the kernel will not know how to parse them with v4 mounts
utils/mount/network.c +9 -6
@@ -90,11 +90,11 @@ static const char *nfs_transport_opttbl[] = {static const char *nfs_version_opttbl[] = {"v2" ,"v3" , +"v4" ,"vers" ,"nfsvers" ,NULL , }; -static const unsigned long nfs_to_mnt[] = {0 ,0 ,
@@ -1203,7 +1203,7 @@ nfs_nfs_program(struct mount_options *options, unsigned long *program)* Returns TRUE if @version contains a valid value for this option, * or FALSE if the option was specified with an invalid value. */ -static int +int nfs_nfs_version (struct mount_options *options,unsigned long *version) {long tmp;
@@ -1215,10 +1215,13 @@ nfs_nfs_version(struct mount_options *options, unsigned long *version)case 1 :/* v3 */ *version =3 ;return 1 ; -case 2 :/* vers */ +case 2 :/* v4 */ + *version =4 ; +return 1 ; +case 3 :/* vers */ switch (po_get_numeric (options,"vers" , &tmp)) {case PO_FOUND : -if (tmp >=2 && tmp <=3 ) { +if (tmp >=2 && tmp <=4 ) { *version = tmp;return 1 ; }
@@ -1229,10 +1232,10 @@ nfs_nfs_version(struct mount_options *options, unsigned long *version)case PO_BAD_VALUE :return 0 ; } -case 3 :/* nfsvers */ +case 4 :/* nfsvers */ switch (po_get_numeric (options,"nfsvers" , &tmp)) {case PO_FOUND : -if (tmp >=2 && tmp <=3 ) { +if (tmp >=2 && tmp <=4 ) { *version = tmp;return 1 ; }
utils/mount/network.h +1 -0
@@ -62,6 +62,7 @@ int nfs_options2pmap(struct mount_options *,int start_statd (void );unsigned long nfsvers_to_mnt (const unsigned long ); +int nfs_nfs_version (struct mount_options *,unsigned long *);int nfs_call_umount (clnt_addr_t *,dirpath *); int nfs_advise_umount(const struct sockaddr *, const socklen_t,
utils/mount/nfsmount.conf +1 -1
@@ -28,7 +28,7 @@ # This statically named section defines global mount # options that can be applied on all NFS mount. # -# Protocol Version [2,3] +# Protocol Version [2,3,4] # Nfsvers=3 # Network Transport [Udp,Tcp,Rdma] # Proto=Tcp
utils/mount/stropts.c +44 -0
56 lines not on this page · raw message
This looks about right, but I'd like a little time to study it more.
This touches code that is also used during mount version/transport negotiation logic, so be on the look out for unexpected changes in v2/v3 negotiation behavior.
Quoted 178 lines · Steve Dickson
Incorporating all the input from the RFC of this patch (thank you very much) here is the actual patch that allows v4 mount to occurr by setting mount version to '4' on the mount command line.
The patch is on the "mount_vers4-r1" branch on my experiential git tree:
git://linux-nfs.org/~steved/nfs-utils-exp.gitComments?
steved.
commit
8ae2bbb042559cd283067322072b6d669819e729Author: Steve Dickson <[email protected]> Date: Mon Aug 24 12:06:51 2009 -0400Enable v4 mounts when either "nfsvers=4" or "vers=4" option are
set.Since nfs4 is a different file system than nfs, the file system
type
has to be set when "v4" or "vers=4" or "nfsvers=4" are used. So when either of these options are specified, the file system type will be set to "nfs4" and those options will be stripped out of the option list since the kernel will not know how to parse them with v4 mountsSigned-off-by Steve Dickson <[email protected]>utils/mount/network.c +2
-2@@ -90,11 +90,11 @@ static const char *nfs_transport_opttbl[] = {static const char *nfs_version_opttbl[] = {"v2" ,"v3" , +"v4" ,"vers" ,"nfsvers" ,NULL , }; -static const unsigned long nfs_to_mnt[] = {0 ,0 ,@@ -1203,7 +1203,7 @@ nfs_nfs_program(struct mount_options *options,unsigned long *program) * Returns TRUE if @version contains a valid value for this option, * or FALSE if the option was specified with an invalid value. */ -static int +int nfs_nfs_version (struct mount_options *options,unsigned long *version) {long tmp;utils/mount/network.c +5
-2@@ -1215,10 +1215,13 @@ nfs_nfs_version(struct mount_options *options, unsigned long *version)case 1 :/* v3 */ *version =3 ;return 1 ; -case 2 :/* vers */ +case 2 :/* v4 */ + *version =4 ; +return 1 ; +case 3 :/* vers */ switch (po_get_numeric (options,"vers" , &tmp)) {case PO_FOUND : -if (tmp >=2 && tmp <=3 ) { +if (tmp >=2 && tmp <=4 ) { *version = tmp;return 1 ;}utils/mount/network.c +2
-2@@ -1229,10 +1232,10 @@ nfs_nfs_version(struct mount_options *options, unsigned long *version)case PO_BAD_VALUE :return 0 ; } -case 3 :/* nfsvers */ +case 4 :/* nfsvers */ switch (po_get_numeric (options,"nfsvers" , &tmp)) {case PO_FOUND : -if (tmp >=2 && tmp <=3 ) { +if (tmp >=2 && tmp <=4 ) { *version = tmp;return 1 ;}utils/mount/network.h +1
-0@@ -62,6 +62,7 @@ int nfs_options2pmap(struct mount_options *,int start_statd (void );unsigned long nfsvers_to_mnt (const unsigned long ); +int nfs_nfs_version (struct mount_options *,unsigned long *);int nfs_call_umount (clnt_addr_t *,dirpath *); int nfs_advise_umount(const struct sockaddr *, const socklen_t,utils/mount/nfsmount.conf +1
-1@@ -28,7 +28,7 @@ # This statically named section defines global mount # options that can be applied on all NFS mount. # -# Protocol Version [2,3] +# Protocol Version [2,3,4] # Nfsvers=3 # Network Transport [Udp,Tcp,Rdma] # Proto=Tcputils/mount/stropts.c +44
-1@@ -656,6 +656,47 @@ static int nfsmount_bg(struct nfsmount_info *mi)return nfsmount_child (mi); } +static const char *nfs_fstype_opttbl[] = { +"v4" , +"vers" , +"nfsvers" , +NULL , +}; + +/* +* Returns either "nfs" or "nfs4" as the file system type +* depending on which (if any) of the nfs version options +* are specified. +*/ +char *nfs_fs_type (struct mount_options *options) +{ +unsigned long version; +static char *fs_type ="nfs" ; + +if (nfs_nfs_version (options, &version) ==0 ) +return fs_type; + +if (version !=4 ) +return fs_type; + + fs_type ="nfs4" ; +switch (po_rightmost (options, nfs_fstype_opttbl)) { +case 0 :/* v4 */ +po_remove_all (options,"v4" ); +break ; +case 1 :/* vers=4 */ +po_remove_all (options,"vers" ); +break ; +case 2 :/* nfsvers=4 */ +po_remove_all (options,"nfsvers" ); +break ; +default :/* Is this even possible ?? */ + fs_type ="nfs" ; + } + +return fs_type; +} +/* * Process mount options and try a mount system call. * @@ -669,6 +710,9 @@ static const char *nfs_background_opttbl[] = {static int nfsmount_start (struct nfsmount_info *mi) { + + mi->type =nfs_fs_type (mi->options); +if (!nfs_validate_options (mi))return EX_FAIL ; --
Quoted 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com
For the record, tested to work with -o vers=4,minorversion=1
Benny
Quoted 176 lines · Steve Dickson
Incorporating all the input from the RFC of this patch (thank you very much) here is the actual patch that allows v4 mount to occurr by setting mount version to '4' on the mount command line.
The patch is on the "mount_vers4-r1" branch on my experiential git tree:
git://linux-nfs.org/~steved/nfs-utils-exp.gitComments?
steved.
commit
8ae2bbb042559cd283067322072b6d669819e729Author: Steve Dickson <[email protected]> Date: Mon Aug 24 12:06:51 2009 -0400Enable v4 mounts when either "nfsvers=4" or "vers=4" option are set.
Since nfs4 is a different file system than nfs, the file system type has to be set when "v4" or "vers=4" or "nfsvers=4" are used. So when either of these options are specified, the file system type will be set to "nfs4" and those options will be stripped out of the option list since the kernel will not know how to parse them with v4 mounts
Signed-off-by Steve Dickson <[email protected]>utils/mount/network.c +9
-6@@ -90,11 +90,11 @@ static const char *nfs_transport_opttbl[] = {static const char *nfs_version_opttbl[] = {"v2" ,"v3" , +"v4" ,"vers" ,"nfsvers" ,NULL , }; -static const unsigned long nfs_to_mnt[] = {0 ,0 ,@@ -1203,7 +1203,7 @@ nfs_nfs_program(struct mount_options *options, unsigned long *program)* Returns TRUE if @version contains a valid value for this option, * or FALSE if the option was specified with an invalid value. */ -static int +int nfs_nfs_version (struct mount_options *options,unsigned long *version) {long tmp;@@ -1215,10 +1215,13 @@ nfs_nfs_version(struct mount_options *options, unsigned long *version)case 1 :/* v3 */ *version =3 ;return 1 ; -case 2 :/* vers */ +case 2 :/* v4 */ + *version =4 ; +return 1 ; +case 3 :/* vers */ switch (po_get_numeric (options,"vers" , &tmp)) {case PO_FOUND : -if (tmp >=2 && tmp <=3 ) { +if (tmp >=2 && tmp <=4 ) { *version = tmp;return 1 ; }@@ -1229,10 +1232,10 @@ nfs_nfs_version(struct mount_options *options, unsigned long *version)case PO_BAD_VALUE :return 0 ; } -case 3 :/* nfsvers */ +case 4 :/* nfsvers */ switch (po_get_numeric (options,"nfsvers" , &tmp)) {case PO_FOUND : -if (tmp >=2 && tmp <=3 ) { +if (tmp >=2 && tmp <=4 ) { *version = tmp;return 1 ; }utils/mount/network.h +1
-0@@ -62,6 +62,7 @@ int nfs_options2pmap(struct mount_options *,int start_statd (void );unsigned long nfsvers_to_mnt (const unsigned long ); +int nfs_nfs_version (struct mount_options *,unsigned long *);int nfs_call_umount (clnt_addr_t *,dirpath *); int nfs_advise_umount(const struct sockaddr *, const socklen_t,utils/mount/nfsmount.conf +1
-1@@ -28,7 +28,7 @@ # This statically named section defines global mount # options that can be applied on all NFS mount. # -# Protocol Version [2,3] +# Protocol Version [2,3,4] # Nfsvers=3 # Network Transport [Udp,Tcp,Rdma] # Proto=Tcputils/mount/stropts.c +44
-0@@ -656,6 +656,47 @@ static int nfsmount_bg(struct nfsmount_info *mi)return nfsmount_child (mi); } +static const char *nfs_fstype_opttbl[] = { +"v4" , +"vers" , +"nfsvers" , +NULL , +}; + +/* +* Returns either "nfs" or "nfs4" as the file system type +* depending on which (if any) of the nfs version options +* are specified. +*/ +char *nfs_fs_type (struct mount_options *options) +{ +unsigned long version; +static char *fs_type ="nfs" ; + +if (nfs_nfs_version (options, &version) ==0 ) +return fs_type; + +if (version !=4 ) +return fs_type; + + fs_type ="nfs4" ; +switch (po_rightmost (options, nfs_fstype_opttbl)) { +case 0 :/* v4 */ +po_remove_all (options,"v4" ); +break ; +case 1 :/* vers=4 */ +po_remove_all (options,"vers" ); +break ; +case 2 :/* nfsvers=4 */ +po_remove_all (options,"nfsvers" ); +break ; +default :/* Is this even possible ?? */ + fs_type ="nfs" ; + } + +return fs_type; +} +/* * Process mount options and try a mount system call. * @@ -669,6 +710,9 @@ static const char *nfs_background_opttbl[] = {static int nfsmount_start (struct nfsmount_info *mi) { + + mi->type =nfs_fs_type (mi->options); +if (!nfs_validate_options (mi))return EX_FAIL ;_______________________________________________
NFSv4 mailing list
[email protected]
http://linux-nfs.org/cgi-bin/mailman/listinfo/nfsv4