summaryrefslogtreecommitdiffstats
path: root/fs/nfs/dir.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2018-05-10 10:34:21 -0400
committerTrond Myklebust <trond.myklebust@hammerspace.com>2018-05-28 13:29:19 -0400
commit9f6d44d418b1f47298a92cd2dc42b8dba8b04816 (patch)
treeda47696347f15bc29d954803c59b6784a8d06163 /fs/nfs/dir.c
parent73dd684a4dcee8c55882a01aeb8b5cbf203de955 (diff)
downloadlinux-stable-9f6d44d418b1f47298a92cd2dc42b8dba8b04816.tar.gz
linux-stable-9f6d44d418b1f47298a92cd2dc42b8dba8b04816.tar.bz2
linux-stable-9f6d44d418b1f47298a92cd2dc42b8dba8b04816.zip
NFS: Optimise away lookups for rename targets
We can optimise away any lookup for a rename target, unless we're being asked to revalidate a dentry that might be in use. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'fs/nfs/dir.c')
-rw-r--r--fs/nfs/dir.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 9dde88334c9c..b315f53b3aec 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1051,13 +1051,15 @@ out_force:
*
* If LOOKUP_RCU prevents us from performing a full check, return 1
* suggesting a reval is needed.
+ *
+ * Note that when creating a new file, or looking up a rename target,
+ * then it shouldn't be necessary to revalidate a negative dentry.
*/
static inline
int nfs_neg_need_reval(struct inode *dir, struct dentry *dentry,
unsigned int flags)
{
- /* Don't revalidate a negative dentry if we're creating a new file */
- if (flags & LOOKUP_CREATE)
+ if (flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET))
return 0;
if (NFS_SERVER(dir)->flags & NFS_MOUNT_LOOKUP_CACHE_NONEG)
return 1;
@@ -1347,7 +1349,7 @@ struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned in
* If we're doing an exclusive create, optimize away the lookup
* but don't hash the dentry.
*/
- if (nfs_is_exclusive_create(dir, flags))
+ if (nfs_is_exclusive_create(dir, flags) || flags & LOOKUP_RENAME_TARGET)
return NULL;
res = ERR_PTR(-ENOMEM);