aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2022-06-27 16:04:02 -0400
committerTrond Myklebust <trond.myklebust@hammerspace.com>2022-07-10 19:00:53 -0400
commit6ca0a6f834ed06b2b4c6d1f7f162f2b0d3e196cf (patch)
tree7805bc0b232dbe3a0c9d0eb233fa2bb5e83b5f8a
parentpNFS/files: Handle RDMA connection errors correctly (diff)
downloadlinux-dev-6ca0a6f834ed06b2b4c6d1f7f162f2b0d3e196cf.tar.xz
linux-dev-6ca0a6f834ed06b2b4c6d1f7f162f2b0d3e196cf.zip
NFS: Fix case insensitive renames
For filesystems that are case insensitive and case preserving, we need to be able to rename from one case folded variant of the filename to another. Currently, if we have looked up the target filename before the call to rename, then we may have a hashed dentry with that target name in the dcache, causing the vfs to optimise away the rename. To avoid that, let's drop the target dentry, and leave it to the server to optimise away the rename if that is the correct thing to do. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
-rw-r--r--fs/nfs/dir.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 0c4e8dd6aa96..d9d277d7fa84 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1739,6 +1739,10 @@ nfs_do_lookup_revalidate(struct inode *dir, struct dentry *dentry,
goto out_bad;
}
+ if ((flags & LOOKUP_RENAME_TARGET) && d_count(dentry) < 2 &&
+ nfs_server_capable(dir, NFS_CAP_CASE_INSENSITIVE))
+ goto out_bad;
+
if (nfs_verifier_is_delegated(dentry))
return nfs_lookup_revalidate_delegated(dir, dentry, inode);