summaryrefslogtreecommitdiff
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2022-11-16 11:11:53 -0500
committerTrond Myklebust <trond.myklebust@hammerspace.com>2022-11-27 22:10:00 -0500
commit5776a9cd2a66cdc037c8e6ee34cde40ee768893d (patch)
treecd3442cc8f4f60dfdd3484bde9721b00f27b07e1 /fs/nfs
parent35e3b6ae84935d0d7ff76cbdaa83411b0ad5e471 (diff)
NFS: Fix a race in nfs_call_unlink()
We should check that the filehandles match before transferring the sillyrename data to the newly looked-up dentry in case the name was reused on the server. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/unlink.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c
index 9697cd5d2561..150a953a8be9 100644
--- a/fs/nfs/unlink.c
+++ b/fs/nfs/unlink.c
@@ -139,6 +139,7 @@ static int nfs_call_unlink(struct dentry *dentry, struct inode *inode, struct nf
*/
spin_lock(&alias->d_lock);
if (d_really_is_positive(alias) &&
+ !nfs_compare_fh(NFS_FH(inode), NFS_FH(d_inode(alias))) &&
!(alias->d_flags & DCACHE_NFSFS_RENAMED)) {
devname_garbage = alias->d_fsdata;
alias->d_fsdata = data;