aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/dir.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2021-12-17 15:36:57 -0500
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2022-01-06 14:00:20 -0500
commit00bdadc7accfce944dc30fbc205cd28a7eed657b (patch)
treee4d2ab7b2b5e8aab6c676b7e99407ef7dce06d26 /fs/nfs/dir.c
parentNFS: Invalidate negative dentries on all case insensitive directory changes (diff)
downloadlinux-dev-00bdadc7accfce944dc30fbc205cd28a7eed657b.tar.xz
linux-dev-00bdadc7accfce944dc30fbc205cd28a7eed657b.zip
NFS: Add a helper to remove case-insensitive aliases
When dealing with case insensitive names, the client has no idea how the server performs the mapping, so cannot collapse the dentries into a single representative. So both rename and unlink need to deal with the fact that there could be several dentries representing the file, and have to somehow force them to be revalidated. Use d_prune_aliases() as a big hammer approach. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'fs/nfs/dir.c')
-rw-r--r--fs/nfs/dir.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index a691a1e364a7..d2a58f7a73a6 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1819,6 +1819,14 @@ out:
}
EXPORT_SYMBOL_GPL(nfs_lookup);
+void nfs_d_prune_case_insensitive_aliases(struct inode *inode)
+{
+ /* Case insensitive server? Revalidate dentries */
+ if (inode && nfs_server_capable(inode, NFS_CAP_CASE_INSENSITIVE))
+ d_prune_aliases(inode);
+}
+EXPORT_SYMBOL_GPL(nfs_d_prune_case_insensitive_aliases);
+
#if IS_ENABLED(CONFIG_NFS_V4)
static int nfs4_lookup_revalidate(struct dentry *, unsigned int);
@@ -2199,8 +2207,10 @@ static void nfs_dentry_remove_handle_error(struct inode *dir,
switch (error) {
case -ENOENT:
d_delete(dentry);
- fallthrough;
+ nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
+ break;
case 0:
+ nfs_d_prune_case_insensitive_aliases(d_inode(dentry));
nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
}
}