Support "-t nfs,vers=4" mounts in the kernel [take 4]
Subsystems (2)
cover Support "-t nfs,vers=4" mounts in the kernel [take 4]
Sorry for the repost. After reading the patch descriptions again, I thought they needed some clarification.
---
Chuck Lever (4):
NFS: Allow the "nfs" file system type to support NFSv4
NFS: Move details of nfs4_get_sb() to a helper
NFS: Refactor NFSv4 text-based mount option validation
NFS: Mount option parser should detect missing "port="
fs/nfs/internal.h | 10 ++ fs/nfs/super.c | 202 +++++++++++++++++++++++++++++++++----------------- include/linux/nfs4.h | 1 3 files changed, 144 insertions(+), 69 deletions(-)
Signature · 1 line
Chuck Lever <[email protected]>
A message that is not in the archive (sent off-list or not yet received): 20090902135032.3550.23170.stgit-RytpoXr2tKZ9HhUboXbp9zCvJB+x5qRC@public.gmane.org
PATCH 1/4 NFS: Mount option parser should detect missing "port="
The meaning of not specifying the "port=" mount option is different for "-t nfs" and "-t nfs4" mounts. The default port value for NFSv2/v3 mounts is 0, but the default for NFSv4 mounts is 2049.
To support "-t nfs -o vers=4", the mount option parser must detect when "port=" is missing so that the correct default port value can be set depending on which NFS version is requested.
---
fs/nfs/internal.h | 9 +++++++-- fs/nfs/super.c | 55 ++++++++++++++++++++++++++++------------------------- 2 files changed, 36 insertions(+), 28 deletions(-)
fs/nfs/internal.h +7 -2
@@ -49,6 +49,11 @@ struct nfs_clone_mount {#define NFS_MAX_SECFLAVORS (12)/* +* Value used if the user did not specify a port value. +*/ +#define NFS_UNSPEC_PORT (-1) + +/* * In-kernel mount arguments */ struct nfs_parsed_mount_data {
@@ -71,7 +76,7 @@ struct nfs_parsed_mount_data {size_t addrlen;char *hostname;u32 version; -unsigned short port; +int port;unsigned short protocol; } mount_server;
@@ -80,7 +85,7 @@ struct nfs_parsed_mount_data {size_t addrlen;char *hostname;char *export_path; -unsigned short port; +int port;unsigned short protocol; } nfs_server;
fs/nfs/super.c +29 -26
125 lines not on this page · raw message
PATCH 2/4 NFS: Refactor NFSv4 text-based mount option validation
In reply to a message not in the archiveClean up: Refactor the part of nfs4_validate_mount_options() that handles text-based options, so we can call it from the NFSv2/v3 option validation function.
---
fs/nfs/super.c | 63 +++++++++++++++++++++++++++++++------------------------- 1 files changed, 35 insertions(+), 28 deletions(-)
fs/nfs/super.c +35 -28
@@ -272,6 +272,8 @@ static const struct super_operations nfs_sops = { };#ifdef CONFIG_NFS_V4 +static int nfs4_validate_text_mount_data (void *options, +struct nfs_parsed_mount_data *args,const char *dev_name);static int nfs4_get_sb (struct file_system_type *fs_type,int flags,const char *dev_name,void *raw_data,struct vfsmount *mnt); static int nfs4_remote_get_sb(struct file_system_type *fs_type,
@@ -2262,6 +2264,37 @@ static void nfs4_validate_mount_flags(struct nfs_parsed_mount_data *args) args->flags &= ~(NFS_MOUNT_NONLM |NFS_MOUNT_NOACL |NFS_MOUNT_VER3 ); } +static int nfs4_validate_text_mount_data (void *options, +struct nfs_parsed_mount_data *args, +const char *dev_name) +{ +struct sockaddr *sap = (struct sockaddr *)&args->nfs_server.address; + +nfs_set_default_port (sap, args->nfs_server.port,NFS_PORT ); + +nfs_validate_transport_protocol (args); + +nfs4_validate_mount_flags (args); + +if (args->auth_flavor_len >1 ) { +dfprintk (MOUNT , +"NFS4: Too many RPC auth flavours specified\n" ); +return -EINVAL ; + } + +if (args->client_address ==NULL ) { +dfprintk (MOUNT , +"NFS4: mount program didn't pass callback address\n" ); +return -EINVAL ; + } + +return nfs_parse_devname (dev_name, + &args->nfs_server.hostname, +NFS4_MAXNAMLEN , + &args->nfs_server.export_path, +NFS4_MAXPATHLEN ); +} +/* * Validate NFSv4 mount options */
@@ -2342,36 +2375,14 @@ static int nfs4_validate_mount_data(void *options,nfs_validate_transport_protocol (args);break ; -default : { -int status; - +default :if (nfs_parse_mount_options ((char *)options, args) ==0 )return -EINVAL ;if (!nfs_verify_server_address (sap))return -EINVAL ; -nfs_set_default_port (sap, args->nfs_server.port,NFS_PORT ); - -nfs_validate_transport_protocol (args); - -nfs4_validate_mount_flags (args); - -if (args->auth_flavor_len >1 ) - goto out_inval_auth; - -if (args->client_address ==NULL ) - goto out_no_client_address; - - status =nfs_parse_devname (dev_name, - &args->nfs_server.hostname, -NFS4_MAXNAMLEN , - &args->nfs_server.export_path, -NFS4_MAXPATHLEN ); -if (status <0 ) -return status; -break ; - } +return nfs4_validate_text_mount_data (options, args, dev_name); }return 0 ;
@@ -2388,10 +2399,6 @@ out_inval_auth: out_no_address:dfprintk (MOUNT ,"NFS4: mount program didn't pass remote address\n" );return -EINVAL ; - -out_no_client_address: -dfprintk (MOUNT ,"NFS4: mount program didn't pass callback address\n" ); -return -EINVAL ; }/*
PATCH 3/4 NFS: Move details of nfs4_get_sb() to a helper
In reply to a message not in the archiveClean up: Refactor nfs4_get_sb() to allow its guts to be invoked by nfs_get_sb().
---
fs/nfs/super.c | 44 +++++++++++++++++++++++++++++++------------- 1 files changed, 31 insertions(+), 13 deletions(-)
fs/nfs/super.c +31 -13
@@ -274,6 +274,8 @@ static const struct super_operations nfs_sops = {#ifdef CONFIG_NFS_V4 static int nfs4_validate_text_mount_data (void *options,struct nfs_parsed_mount_data *args,const char *dev_name); +static int nfs4_try_mount (int flags,const char *dev_name, +struct nfs_parsed_mount_data *data,struct vfsmount *mnt);static int nfs4_get_sb (struct file_system_type *fs_type,int flags,const char *dev_name,void *raw_data,struct vfsmount *mnt); static int nfs4_remote_get_sb(struct file_system_type *fs_type,
@@ -2565,6 +2567,34 @@ out_err:return ret; } +static int nfs4_try_mount (int flags,const char *dev_name, +struct nfs_parsed_mount_data *data, +struct vfsmount *mnt) +{ +char *export_path; +struct vfsmount *root_mnt; +int error; + +dfprintk (MOUNT ,"--> nfs4_try_mount()\n" ); + + export_path = data->nfs_server.export_path; + data->nfs_server.export_path ="/" ; + root_mnt =nfs_do_root_mount (&nfs4_remote_fs_type, flags, data, + data->nfs_server.hostname); + data->nfs_server.export_path = export_path; + + error =PTR_ERR (root_mnt); +if (IS_ERR (root_mnt)) + goto out; + + error =nfs_follow_remote_path (root_mnt, export_path, mnt); + +out: +dfprintk (MOUNT ,"<-- nfs4_try_mount() = %d%s\n" , error, + error !=0 ?" [error]" :"" ); +return error; +} +/* * Get the superblock for an NFS4 mountpoint */
@@ -2572,8 +2602,6 @@ static int nfs4_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt) { struct nfs_parsed_mount_data *data; -char *export_path; -struct vfsmount *root_mnt;int error = -ENOMEM ; data =kzalloc (sizeof (*data),GFP_KERNEL );
@@ -2585,17 +2613,7 @@ static int nfs4_get_sb(struct file_system_type *fs_type,if (error <0 ) goto out; - export_path = data->nfs_server.export_path; - data->nfs_server.export_path ="/" ; - root_mnt =nfs_do_root_mount (&nfs4_remote_fs_type, flags, data, - data->nfs_server.hostname); - data->nfs_server.export_path = export_path; - - error =PTR_ERR (root_mnt); -if (IS_ERR (root_mnt)) - goto out; - - error =nfs_follow_remote_path (root_mnt, export_path, mnt); + error =nfs4_try_mount (flags, dev_name, data, mnt); out:kfree (data->client_address);
PATCH 4/4 NFS: Allow the "nfs" file system type to support NFSv4
In reply to a message not in the archiveWhen mounting an "nfs" type file system, recognize "v4," "vers=4," or "nfsvers=4" mount options, and convert the file system to "nfs4" under the covers.
---
fs/nfs/internal.h | 1 + fs/nfs/super.c | 42 +++++++++++++++++++++++++++++++++++++++++- include/linux/nfs4.h | 1 + 3 files changed, 43 insertions(+), 1 deletions(-)
fs/nfs/internal.h +1 -0
@@ -68,6 +68,7 @@ struct nfs_parsed_mount_data {unsigned int auth_flavor_len;rpc_authflavor_t auth_flavors[1 ];char *client_address; +unsigned int version;unsigned int minorversion;char *fscache_uniq;
fs/nfs/super.c +41 -1
98 lines not on this page · raw message
include/linux/nfs4.h +1 -0
@@ -472,6 +472,7 @@ enum lock_type4 {#define NFSPROC4_NULL 0#define NFSPROC4_COMPOUND 1 +#define NFS4_VERSION 4#define NFS4_MINOR_VERSION 0#if defined(CONFIG_NFS_V4_1 )
A message that is not in the archive (sent off-list or not yet received): 20090902135222.3550.59986.stgit-RytpoXr2tKZ9HhUboXbp9zCvJB+x5qRC@public.gmane.org
Re: [PATCH 4/4] NFS: Allow the "nfs" file system type to support NFSv4
Quoted 6 lines · Chuck Lever
When mounting an "nfs" type file system, recognize "v4," "vers=4," or "nfsvers=4" mount options, and convert the file system to "nfs4" under the covers.
Signed-off-by Chuck Lever <[email protected]>---
For consistency, can we please ensure that we set the nfs_parsed_mount_data->version in the binary mount case too?
The other thing to note is that we should not allow vers=2,3 in the -t nfs4 case.
I'll fix the former inline in your patch 4/4, and add the latter as a separate patch.
Cheers
Trond
Quoted 12 lines · Chuck Lever
Sorry for the repost. After reading the patch descriptions again, I thought they needed some clarification.
---
Chuck Lever (4):
NFS: Allow the "nfs" file system type to support NFSv4
NFS: Move details ofnfs4_get_sb()to a helper
NFS: Refactor NFSv4 text-based mount option validation
NFS: Mount option parser should detect missing "port="
Quoted 5 lines
fs/nfs/internal.h | 10 ++ fs/nfs/super.c | 202 +++++++++++++++++++++++++++++++++----------------- include/linux/nfs4.h | 1 3 files changed, 144 insertions(+), 69 deletions(-)
Trond, is there an ETA on this?
</rant>
We've turned a simple 2 patch solution into a 4 user space patches and 4 kernel patches to simply added a short cut to mount the nfs4 file system... If this not an example of over engineering then I don't know what its... </rant>
steved.
Quoted 12 lines · Chuck Lever
Sorry for the repost. After reading the patch descriptions again, I thought they needed some clarification.
---
Chuck Lever (4):
NFS: Allow the "nfs" file system type to support NFSv4
NFS: Move details ofnfs4_get_sb()to a helper
NFS: Refactor NFSv4 text-based mount option validation
NFS: Mount option parser should detect missing "port="
Quoted 5 lines
fs/nfs/internal.h | 10 ++ fs/nfs/super.c | 202 +++++++++++++++++++++++++++++++++----------------- include/linux/nfs4.h | 1 3 files changed, 144 insertions(+), 69 deletions(-)
Trond,
I'm updating the mount.nfs man pages, and would like give an guess-ta-mate as to which kernel these patches will be in. Any ideas?
steved.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 18 lines · Steve Dickson
Quoted 12 lines · Chuck Lever
Sorry for the repost. After reading the patch descriptions again, I thought they needed some clarification.
---
Chuck Lever (4):
NFS: Allow the "nfs" file system type to support NFSv4
NFS: Move details ofnfs4_get_sb()to a helper
NFS: Refactor NFSv4 text-based mount option validation
NFS: Mount option parser should detect missing "port="Quoted 5 lines
fs/nfs/internal.h | 10 ++ fs/nfs/super.c | 202 +++++++++++++++++++++++++++++++++----------------- include/linux/nfs4.h | 1 3 files changed, 144 insertions(+), 69 deletions(-)
Quoted 5 lines
Trond,
I'm updating the mount.nfs man pages, and would like give an guess-ta-mate as to which kernel these patches will be in. Any ideas?
I'm planning on pushing them out in the upcoming merge window, since the patches themselves seem pretty straightforward. I've applied the fixes that I suggested, and added the patch to disable vers!=4 in the '-t nfs4' case.
If you'd like to test it all out, I've pushed those patches into the nfs-for-2.6.32 branch of my git tree. They should also appear in linux-next.
Cheers
Trond
Signature · 6 lines
Trond Myklebust Linux NFS client maintainer NetApp [email protected] www.netapp.com
A message that is not in the archive (sent off-list or not yet received): 1252517471.8722.19.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org
Quoted 25 lines · Trond Myklebust
Quoted 18 lines · Steve Dickson
Quoted 12 lines · Chuck Lever
Sorry for the repost. After reading the patch descriptions again, I thought they needed some clarification.
---
Chuck Lever (4):
NFS: Allow the "nfs" file system type to support NFSv4
NFS: Move details ofnfs4_get_sb()to a helper
NFS: Refactor NFSv4 text-based mount option validation
NFS: Mount option parser should detect missing "port="Quoted 5 lines
fs/nfs/internal.h | 10 ++ fs/nfs/super.c | 202 +++++++++++++++++++++++++++++++++----------------- include/linux/nfs4.h | 1 3 files changed, 144 insertions(+), 69 deletions(-)Quoted 5 lines
Trond,
I'm updating the mount.nfs man pages, and would like give an guess-ta-mate as to which kernel these patches will be in. Any ideas?
Quoted 8 lines
I'm planning on pushing them out in the upcoming merge window, since the patches themselves seem pretty straightforward. I've applied the fixes that I suggested, and added the patch to disable vers!=4 in the '-t nfs4' case.
If you'd like to test it all out, I've pushed those patches into the nfs-for-2.6.32 branch of my git tree. They should also appear in linux-next.
Cool... thanks!
steved.
Quoted 14 lines · Trond Myklebust
Quoted 13 lines · Steve Dickson
Quoted 12 lines · Chuck Lever
Sorry for the repost. After reading the patch descriptions again, I thought they needed some clarification.
---
Chuck Lever (4):
NFS: Allow the "nfs" file system type to support NFSv4
NFS: Move details ofnfs4_get_sb()to a helper
NFS: Refactor NFSv4 text-based mount option validation
NFS: Mount option parser should detect missing "port="
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
fs/nfs/internal.h | 10 ++ fs/nfs/super.c | 202 +++++++++++++++++++++++++++++++++-----------------
include/linux/nfs4.h| 1 These patches (after a bit of back porting) are now in the F-12 and Rawhide
kernels,
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
3 files changed, 144 insertions(+), 69 deletions(-)Trond,
I'm updating the mount.nfs man pages, and would like give an guess-ta-mate as to which kernel these patches will be in. Any ideas?
Quoted 8 lines
I'm planning on pushing them out in the upcoming merge window, since the patches themselves seem pretty straightforward. I've applied the fixes that I suggested, and added the patch to disable vers!=4 in the '-t nfs4' case.
If you'd like to test it all out, I've pushed those patches into the nfs-for-2.6.32 branch of my git tree. They should also appear in linux-next.
After a weekend of testing these patches along with Chunk's mount.nfs patches, I committed these patches (after some back porting) to both the Fedora F-12 and Rawhide kernels, which means they will get plenty of testing by the time 2.6.32 rolls around...
steved.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 32 lines · Steve Dickson
Quoted 14 lines · Trond Myklebust
Quoted 13 lines · Steve Dickson
Quoted 12 lines · Chuck Lever
Sorry for the repost. After reading the patch descriptions again, I thought they needed some clarification.
---
Chuck Lever (4):
NFS: Allow the "nfs" file system type to support NFSv4
NFS: Move details ofnfs4_get_sb()to a helper
NFS: Refactor NFSv4 text-based mount option validation
NFS: Mount option parser should detect missing "port="Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
fs/nfs/internal.h | 10 ++ fs/nfs/super.c | 202 +++++++++++++++++++++++++++++++++-----------------
include/linux/nfs4.h| 1 These patches (after a bit of back porting) are now in the F-12 and Rawhidekernels,
Quoted 13 lines
Quoted 7 lines
Quoted 2 lines
3 files changed, 144 insertions(+), 69 deletions(-)Trond,
I'm updating the mount.nfs man pages, and would like give an guess-ta-mate as to which kernel these patches will be in. Any ideas?
I'm planning on pushing them out in the upcoming merge window, since the patches themselves seem pretty straightforward. I've applied the fixes that I suggested, and added the patch to disable vers!=4 in the '-t nfs4' case.
Quoted 7 lines
Quoted 3 lines
If you'd like to test it all out, I've pushed those patches into the nfs-for-2.6.32 branch of my git tree. They should also appear in linux-next.
After a weekend of testing these patches along with Chunk's mount.nfs patches, I committed these patches (after some back porting) to both the Fedora F-12 and Rawhide kernels, which means they will get plenty of testing by the time 2.6.32 rolls around...
Thanks! I've already pushed them upstream to Linus.
Cheers
Trond
Signature · 6 lines
Trond Myklebust Linux NFS client maintainer NetApp [email protected] www.netapp.com