@@ -26,11 +26,6 @@ static LIST_HEAD(nfs_automount_list);
2626static DECLARE_DELAYED_WORK (nfs_automount_task , nfs_expire_automounts ) ;
2727int nfs_mountpoint_expiry_timeout = 500 * HZ ;
2828
29- static struct vfsmount * nfs_do_submount (struct dentry * dentry ,
30- struct nfs_fh * fh ,
31- struct nfs_fattr * fattr ,
32- rpc_authflavor_t authflavor );
33-
3429/*
3530 * nfs_path - reconstruct the path given an arbitrary dentry
3631 * @base - used to return pointer to the end of devname part of path
@@ -118,35 +113,6 @@ char *nfs_path(char **p, struct dentry *dentry, char *buffer, ssize_t buflen)
118113 return ERR_PTR (- ENAMETOOLONG );
119114}
120115
121- #ifdef CONFIG_NFS_V4
122- static struct rpc_clnt * nfs_lookup_mountpoint (struct inode * dir ,
123- struct qstr * name ,
124- struct nfs_fh * fh ,
125- struct nfs_fattr * fattr )
126- {
127- int err ;
128-
129- if (NFS_PROTO (dir )-> version == 4 )
130- return nfs4_proc_lookup_mountpoint (dir , name , fh , fattr );
131-
132- err = NFS_PROTO (dir )-> lookup (NFS_SERVER (dir )-> client , dir , name , fh , fattr );
133- if (err )
134- return ERR_PTR (err );
135- return rpc_clone_client (NFS_SERVER (dir )-> client );
136- }
137- #else /* CONFIG_NFS_V4 */
138- static inline struct rpc_clnt * nfs_lookup_mountpoint (struct inode * dir ,
139- struct qstr * name ,
140- struct nfs_fh * fh ,
141- struct nfs_fattr * fattr )
142- {
143- int err = NFS_PROTO (dir )-> lookup (NFS_SERVER (dir )-> client , dir , name , fh , fattr );
144- if (err )
145- return ERR_PTR (err );
146- return rpc_clone_client (NFS_SERVER (dir )-> client );
147- }
148- #endif /* CONFIG_NFS_V4 */
149-
150116/*
151117 * nfs_d_automount - Handle crossing a mountpoint on the server
152118 * @path - The mountpoint
@@ -162,10 +128,9 @@ static inline struct rpc_clnt *nfs_lookup_mountpoint(struct inode *dir,
162128struct vfsmount * nfs_d_automount (struct path * path )
163129{
164130 struct vfsmount * mnt ;
165- struct dentry * parent ;
131+ struct nfs_server * server = NFS_SERVER ( path -> dentry -> d_inode ) ;
166132 struct nfs_fh * fh = NULL ;
167133 struct nfs_fattr * fattr = NULL ;
168- struct rpc_clnt * client ;
169134
170135 dprintk ("--> nfs_d_automount()\n" );
171136
@@ -181,21 +146,7 @@ struct vfsmount *nfs_d_automount(struct path *path)
181146
182147 dprintk ("%s: enter\n" , __func__ );
183148
184- /* Look it up again to get its attributes */
185- parent = dget_parent (path -> dentry );
186- client = nfs_lookup_mountpoint (parent -> d_inode , & path -> dentry -> d_name , fh , fattr );
187- dput (parent );
188- if (IS_ERR (client )) {
189- mnt = ERR_CAST (client );
190- goto out ;
191- }
192-
193- if (fattr -> valid & NFS_ATTR_FATTR_V4_REFERRAL )
194- mnt = nfs_do_refmount (client , path -> dentry );
195- else
196- mnt = nfs_do_submount (path -> dentry , fh , fattr , client -> cl_auth -> au_flavor );
197- rpc_shutdown_client (client );
198-
149+ mnt = server -> nfs_client -> rpc_ops -> submount (server , path -> dentry , fh , fattr );
199150 if (IS_ERR (mnt ))
200151 goto out ;
201152
@@ -268,10 +219,8 @@ static struct vfsmount *nfs_do_clone_mount(struct nfs_server *server,
268219 * @authflavor - security flavor to use when performing the mount
269220 *
270221 */
271- static struct vfsmount * nfs_do_submount (struct dentry * dentry ,
272- struct nfs_fh * fh ,
273- struct nfs_fattr * fattr ,
274- rpc_authflavor_t authflavor )
222+ struct vfsmount * nfs_do_submount (struct dentry * dentry , struct nfs_fh * fh ,
223+ struct nfs_fattr * fattr , rpc_authflavor_t authflavor )
275224{
276225 struct nfs_clone_mount mountdata = {
277226 .sb = dentry -> d_sb ,
@@ -304,3 +253,19 @@ static struct vfsmount *nfs_do_submount(struct dentry *dentry,
304253 dprintk ("<-- nfs_do_submount() = %p\n" , mnt );
305254 return mnt ;
306255}
256+
257+ struct vfsmount * nfs_submount (struct nfs_server * server , struct dentry * dentry ,
258+ struct nfs_fh * fh , struct nfs_fattr * fattr )
259+ {
260+ int err ;
261+ struct dentry * parent = dget_parent (dentry );
262+
263+ /* Look it up again to get its attributes */
264+ err = server -> nfs_client -> rpc_ops -> lookup (server -> client , parent -> d_inode ,
265+ & dentry -> d_name , fh , fattr );
266+ dput (parent );
267+ if (err != 0 )
268+ return ERR_PTR (err );
269+
270+ return nfs_do_submount (dentry , fh , fattr , server -> client -> cl_auth -> au_flavor );
271+ }
0 commit comments