aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2006-08-22 20:06:09 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-09-22 23:24:32 -0400
commit2b3de4411b3ccaeb00018c99d1bbe7203554cf7f (patch)
treecb49ea1fe64835fdbb8335a55049e70b3d87c5ae /fs/nfs/nfs4proc.c
parentb7162792b5c0e0f6e91b8997f8e6bbc76ec5420a (diff)
NFS: Add a lookupfh NFS RPC op
Add a lookup filehandle NFS RPC op so that a file handle can be looked up without requiring dentries and inodes and other VFS stuff when doing an NFS4 pathwalk during mounting. Signed-Off-By: David Howells <dhowells@redhat.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index b46597fc81e1..de2006f754ef 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1583,6 +1583,52 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
1583 return status; 1583 return status;
1584} 1584}
1585 1585
1586static int _nfs4_proc_lookupfh(struct nfs_server *server, struct nfs_fh *dirfh,
1587 struct qstr *name, struct nfs_fh *fhandle,
1588 struct nfs_fattr *fattr)
1589{
1590 int status;
1591 struct nfs4_lookup_arg args = {
1592 .bitmask = server->attr_bitmask,
1593 .dir_fh = dirfh,
1594 .name = name,
1595 };
1596 struct nfs4_lookup_res res = {
1597 .server = server,
1598 .fattr = fattr,
1599 .fh = fhandle,
1600 };
1601 struct rpc_message msg = {
1602 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_LOOKUP],
1603 .rpc_argp = &args,
1604 .rpc_resp = &res,
1605 };
1606
1607 nfs_fattr_init(fattr);
1608
1609 dprintk("NFS call lookupfh %s\n", name->name);
1610 status = rpc_call_sync(server->client, &msg, 0);
1611 dprintk("NFS reply lookupfh: %d\n", status);
1612 if (status == -NFS4ERR_MOVED)
1613 status = -EREMOTE;
1614 return status;
1615}
1616
1617static int nfs4_proc_lookupfh(struct nfs_server *server, struct nfs_fh *dirfh,
1618 struct qstr *name, struct nfs_fh *fhandle,
1619 struct nfs_fattr *fattr)
1620{
1621 struct nfs4_exception exception = { };
1622 int err;
1623 do {
1624 err = nfs4_handle_exception(server,
1625 _nfs4_proc_lookupfh(server, dirfh, name,
1626 fhandle, fattr),
1627 &exception);
1628 } while (exception.retry);
1629 return err;
1630}
1631
1586static int _nfs4_proc_lookup(struct inode *dir, struct qstr *name, 1632static int _nfs4_proc_lookup(struct inode *dir, struct qstr *name,
1587 struct nfs_fh *fhandle, struct nfs_fattr *fattr) 1633 struct nfs_fh *fhandle, struct nfs_fattr *fattr)
1588{ 1634{
@@ -3723,6 +3769,7 @@ struct nfs_rpc_ops nfs_v4_clientops = {
3723 .getroot = nfs4_proc_get_root, 3769 .getroot = nfs4_proc_get_root,
3724 .getattr = nfs4_proc_getattr, 3770 .getattr = nfs4_proc_getattr,
3725 .setattr = nfs4_proc_setattr, 3771 .setattr = nfs4_proc_setattr,
3772 .lookupfh = nfs4_proc_lookupfh,
3726 .lookup = nfs4_proc_lookup, 3773 .lookup = nfs4_proc_lookup,
3727 .access = nfs4_proc_access, 3774 .access = nfs4_proc_access,
3728 .readlink = nfs4_proc_readlink, 3775 .readlink = nfs4_proc_readlink,