diff options
author | Trond Myklebust <trond.myklebust@hammerspace.com> | 2021-09-29 08:12:53 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@hammerspace.com> | 2021-10-03 20:49:07 -0400 |
commit | cec08f452a687fce9dfdf47946d00a1d12a8bec5 (patch) | |
tree | 449035ba957d3b01c14d3e77bd4b7f2a7fbe44ba | |
parent | ff81dfb5d721fff87bd516c558847f6effb70031 (diff) |
NFS: Fix dentry verifier races
If the directory changed while we were revalidating the dentry, then
don't update the dentry verifier. There is no value in setting the
verifier to an older value, and we could end up overwriting a more up to
date verifier from a parallel revalidation.
Fixes: efeda80da38d ("NFSv4: Fix revalidation of dentries with delegations")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Tested-by: Benjamin Coddington <bcodding@redhat.com>
Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
-rw-r--r-- | fs/nfs/dir.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 33cfff8ea551..3fafecdb2070 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -1276,13 +1276,12 @@ static bool nfs_verifier_is_delegated(struct dentry *dentry) static void nfs_set_verifier_locked(struct dentry *dentry, unsigned long verf) { struct inode *inode = d_inode(dentry); + struct inode *dir = d_inode(dentry->d_parent); - if (!nfs_verifier_is_delegated(dentry) && - !nfs_verify_change_attribute(d_inode(dentry->d_parent), verf)) - goto out; + if (!nfs_verify_change_attribute(dir, verf)) + return; if (inode && NFS_PROTO(inode)->have_delegation(inode, FMODE_READ)) nfs_set_verifier_delegated(&verf); -out: dentry->d_time = verf; } |