* [PATCH] NFS: Fix a race in nfs_call_unlink()
@ 2022-11-17 13:47 trondmy
0 siblings, 0 replies; only message in thread
From: trondmy @ 2022-11-17 13:47 UTC (permalink / raw)
To: linux-nfs
From: Trond Myklebust <trond.myklebust@hammerspace.com>
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>
---
fs/nfs/unlink.c | 1 +
1 file changed, 1 insertion(+)
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;
--
2.38.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-11-17 13:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-17 13:47 [PATCH] NFS: Fix a race in nfs_call_unlink() trondmy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox