diff options
author | Bryan Schumaker <bjschuma@netapp.com> | 2012-04-27 13:27:45 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-04-27 14:10:39 -0400 |
commit | 281cad46b34db4dbb1d1e603f7b9cfe25d1ae7c9 (patch) | |
tree | f13917030755776a4f80ffcc0d07c2b5da60066d /fs/nfs/nfs4namespace.c | |
parent | 2671bfc3beb44e70636bd0208274426db57f73b5 (diff) |
NFS: Create a submount rpc_op
This simplifies the code for v2 and v3 and gives v4 a chance to decide
on referrals without needing to modify the generic client.
Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4namespace.c')
-rw-r--r-- | fs/nfs/nfs4namespace.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c index a69ee3952bbe..80fc0fe7095e 100644 --- a/fs/nfs/nfs4namespace.c +++ b/fs/nfs/nfs4namespace.c | |||
@@ -329,7 +329,7 @@ out: | |||
329 | * @dentry - dentry of referral | 329 | * @dentry - dentry of referral |
330 | * | 330 | * |
331 | */ | 331 | */ |
332 | struct vfsmount *nfs_do_refmount(struct rpc_clnt *client, struct dentry *dentry) | 332 | static struct vfsmount *nfs_do_refmount(struct rpc_clnt *client, struct dentry *dentry) |
333 | { | 333 | { |
334 | struct vfsmount *mnt = ERR_PTR(-ENOMEM); | 334 | struct vfsmount *mnt = ERR_PTR(-ENOMEM); |
335 | struct dentry *parent; | 335 | struct dentry *parent; |
@@ -370,3 +370,25 @@ out: | |||
370 | dprintk("%s: done\n", __func__); | 370 | dprintk("%s: done\n", __func__); |
371 | return mnt; | 371 | return mnt; |
372 | } | 372 | } |
373 | |||
374 | struct vfsmount *nfs4_submount(struct nfs_server *server, struct dentry *dentry, | ||
375 | struct nfs_fh *fh, struct nfs_fattr *fattr) | ||
376 | { | ||
377 | struct dentry *parent = dget_parent(dentry); | ||
378 | struct rpc_clnt *client; | ||
379 | struct vfsmount *mnt; | ||
380 | |||
381 | /* Look it up again to get its attributes and sec flavor */ | ||
382 | client = nfs4_proc_lookup_mountpoint(parent->d_inode, &dentry->d_name, fh, fattr); | ||
383 | dput(parent); | ||
384 | if (IS_ERR(client)) | ||
385 | return ERR_CAST(client); | ||
386 | |||
387 | if (fattr->valid & NFS_ATTR_FATTR_V4_REFERRAL) | ||
388 | mnt = nfs_do_refmount(client, dentry); | ||
389 | else | ||
390 | mnt = nfs_do_submount(dentry, fh, fattr, client->cl_auth->au_flavor); | ||
391 | |||
392 | rpc_shutdown_client(client); | ||
393 | return mnt; | ||
394 | } | ||