]> Pileus Git - ~andy/linux/commitdiff
NFS: Create a try_mount rpc op
authorBryan Schumaker <bjschuma@netapp.com>
Mon, 30 Jul 2012 20:05:18 +0000 (16:05 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Mon, 30 Jul 2012 23:04:53 +0000 (19:04 -0400)
I'm already looking up the nfs subversion in nfs_fs_mount(), so I have
easy access to rpc_ops that used to be difficult to reach.  This allows
me to set up a different mount path for NFS v2/3 and NFS v4.

Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/internal.h
fs/nfs/nfs3proc.c
fs/nfs/nfs4_fs.h
fs/nfs/nfs4proc.c
fs/nfs/nfs4super.c
fs/nfs/proc.c
fs/nfs/super.c
include/linux/nfs_xdr.h

index ac936476b3bc7ae37a4a60bef01b79f1014d3762..3364eccd17efb628823e5aa155baa797d92d02ff 100644 (file)
@@ -328,6 +328,8 @@ extern struct file_system_type nfs_xdev_fs_type;
 extern struct file_system_type nfs4_xdev_fs_type;
 extern struct file_system_type nfs4_referral_fs_type;
 #endif
+struct dentry *nfs_try_mount(int, const char *, struct nfs_mount_info *,
+                       struct nfs_subversion *);
 void nfs_initialise_sb(struct super_block *);
 int nfs_set_sb_security(struct super_block *, struct dentry *, struct nfs_mount_info *);
 int nfs_clone_sb_security(struct super_block *, struct dentry *, struct nfs_mount_info *);
index 65d23eb92fe03650dee0dda65d3e81d6e30ae0b7..4f4cb8e49716493f5a4841c1377b16c6af2604c7 100644 (file)
@@ -925,6 +925,7 @@ const struct nfs_rpc_ops nfs_v3_clientops = {
        .file_ops       = &nfs_file_operations,
        .getroot        = nfs3_proc_get_root,
        .submount       = nfs_submount,
+       .try_mount      = nfs_try_mount,
        .getattr        = nfs3_proc_getattr,
        .setattr        = nfs3_proc_setattr,
        .lookup         = nfs3_proc_lookup,
index 99c2e7e4d3eaf1ad5cb395863c9b378306cf7ad8..c321fb59d801d2701c728ffef5df4ef9a5f92885 100644 (file)
@@ -367,7 +367,7 @@ extern const nfs4_stateid zero_stateid;
 /* nfs4super.c */
 struct nfs_mount_info;
 extern struct nfs_subversion nfs_v4;
-struct dentry *nfs4_try_mount(int, const char *, struct nfs_mount_info *);
+struct dentry *nfs4_try_mount(int, const char *, struct nfs_mount_info *, struct nfs_subversion *);
 int init_nfs_v4(void);
 void exit_nfs_v4(void);
 
index 6843e0a37de8eb900421ae118d76c889afe041ef..eb4ba1d99df92712aa4e748e76a7553c65687491 100644 (file)
@@ -6870,6 +6870,7 @@ const struct nfs_rpc_ops nfs_v4_clientops = {
        .file_ops       = &nfs4_file_operations,
        .getroot        = nfs4_proc_get_root,
        .submount       = nfs4_submount,
+       .try_mount      = nfs4_try_mount,
        .getattr        = nfs4_proc_getattr,
        .setattr        = nfs4_proc_setattr,
        .lookup         = nfs4_proc_lookup,
index 8a505573c2898da482dc79e5f02cae344e0b5641..9384f666b6abaa3f79fdd67bd3c86436514b7afd 100644 (file)
@@ -226,7 +226,8 @@ static struct dentry *nfs_follow_remote_path(struct vfsmount *root_mnt,
 }
 
 struct dentry *nfs4_try_mount(int flags, const char *dev_name,
-                        struct nfs_mount_info *mount_info)
+                             struct nfs_mount_info *mount_info,
+                             struct nfs_subversion *nfs_mod)
 {
        char *export_path;
        struct vfsmount *root_mnt;
index 4d3356af330975b38491d89e6ea32bb37cda5523..ebb3d9c5227bcba5cf3340043c5099e37a1b6f69 100644 (file)
@@ -774,6 +774,7 @@ const struct nfs_rpc_ops nfs_v2_clientops = {
        .file_ops       = &nfs_file_operations,
        .getroot        = nfs_proc_get_root,
        .submount       = nfs_submount,
+       .try_mount      = nfs_try_mount,
        .getattr        = nfs_proc_getattr,
        .setattr        = nfs_proc_setattr,
        .lookup         = nfs_proc_lookup,
index 4faefa19a8c39a88853338c74658205b6926ba59..5fca59d73e40fd16a7c4995b0d098f4e63b6fe22 100644 (file)
@@ -1650,9 +1650,9 @@ static int nfs_request_mount(struct nfs_parsed_mount_data *args,
        return nfs_walk_authlist(args, &request);
 }
 
-static struct dentry *nfs_try_mount(int flags, const char *dev_name,
-                                   struct nfs_mount_info *mount_info,
-                                   struct nfs_subversion *nfs_mod)
+struct dentry *nfs_try_mount(int flags, const char *dev_name,
+                            struct nfs_mount_info *mount_info,
+                            struct nfs_subversion *nfs_mod)
 {
        int status;
        struct nfs_server *server;
@@ -2403,15 +2403,9 @@ struct dentry *nfs_fs_mount(struct file_system_type *fs_type,
                goto out;
        }
 
-#ifdef CONFIG_NFS_V4
-       if (mount_info.parsed->version == 4)
-               mntroot = nfs4_try_mount(flags, dev_name, &mount_info);
-       else
-#endif /* CONFIG_NFS_V4 */
-               mntroot = nfs_try_mount(flags, dev_name, &mount_info, nfs_mod);
+       mntroot = nfs_mod->rpc_ops->try_mount(flags, dev_name, &mount_info, nfs_mod);
 
        put_nfs_version(nfs_mod);
-
 out:
        nfs_free_parsed_mount_data(mount_info.parsed);
        nfs_free_fhandle(mount_info.mntfh);
index 0e181c2320b7796bc9ed41cb3ebfc4c56a885339..bc7415baf44dc6c4398d356bc97420fa9b85b7bf 100644 (file)
@@ -1353,6 +1353,8 @@ struct nfs_renamedata {
 struct nfs_access_entry;
 struct nfs_client;
 struct rpc_timeout;
+struct nfs_subversion;
+struct nfs_mount_info;
 struct nfs_client_initdata;
 struct nfs_pageio_descriptor;
 
@@ -1370,6 +1372,8 @@ struct nfs_rpc_ops {
                            struct nfs_fsinfo *);
        struct vfsmount *(*submount) (struct nfs_server *, struct dentry *,
                                      struct nfs_fh *, struct nfs_fattr *);
+       struct dentry *(*try_mount) (int, const char *, struct nfs_mount_info *,
+                                    struct nfs_subversion *);
        int     (*getattr) (struct nfs_server *, struct nfs_fh *,
                            struct nfs_fattr *);
        int     (*setattr) (struct dentry *, struct nfs_fattr *,