Commit 3322b8ec authored by Trond Myklebust's avatar Trond Myklebust Committed by Linus Torvalds

[PATCH] Reduce the number of getattr/lookup calls in nfs_lookup_revalidate()

Reduce the number of getattr/lookup calls in nfs_lookup_revalidate()
by making the latter rely on the ordinary attribute cache, and moving
the close-to-open data consistency checking into nfs_open().

This does mean that we can end up calling GETATTR twice: once in
nfs_lookup_revalidate() then immediately after in nfs_open(), however
it also means that sys_stat() and friends now use cached attributes.
parent ff3cc6a0
......@@ -430,16 +430,9 @@ static inline void nfs_renew_times(struct dentry * dentry)
}
static inline
int nfs_lookup_verify_inode(struct inode *inode, int flags)
int nfs_lookup_verify_inode(struct inode *inode)
{
struct nfs_server *server = NFS_SERVER(inode);
/*
* If we're interested in close-to-open cache consistency,
* then we revalidate the inode upon lookup.
*/
if (!(server->flags & NFS_MOUNT_NOCTO) && !(flags & LOOKUP_CONTINUE))
NFS_CACHEINV(inode);
return nfs_revalidate_inode(server, inode);
return nfs_revalidate_inode(NFS_SERVER(inode), inode);
}
/*
......@@ -497,7 +490,7 @@ static int nfs_lookup_revalidate(struct dentry * dentry, int flags)
/* Force a full look up iff the parent directory has changed */
if (nfs_check_verifier(dir, dentry)) {
if (nfs_lookup_verify_inode(inode, flags))
if (nfs_lookup_verify_inode(inode))
goto out_bad;
goto out_valid;
}
......
......@@ -855,15 +855,23 @@ int nfs_open(struct inode *inode, struct file *filp)
{
struct rpc_auth *auth;
struct rpc_cred *cred;
int err = 0;
lock_kernel();
/* Ensure that we revalidate the data cache */
if (NFS_SERVER(inode)->flags & NFS_MOUNT_NOCTO) {
err = __nfs_revalidate_inode(NFS_SERVER(inode),inode);
if (err)
goto out;
}
auth = NFS_CLIENT(inode)->cl_auth;
cred = rpcauth_lookupcred(auth, 0);
filp->private_data = cred;
if (filp->f_mode & FMODE_WRITE)
nfs_set_mmcred(inode, cred);
out:
unlock_kernel();
return 0;
return err;
}
int nfs_release(struct inode *inode, struct file *filp)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment