Commit cec08f45 authored by Trond Myklebust's avatar Trond Myklebust

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: efeda80d ("NFSv4: Fix revalidation of dentries with delegations")
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Tested-by: default avatarBenjamin Coddington <bcodding@redhat.com>
Reviewed-by: default avatarBenjamin Coddington <bcodding@redhat.com>
parent ff81dfb5
...@@ -1276,13 +1276,12 @@ static bool nfs_verifier_is_delegated(struct dentry *dentry) ...@@ -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) static void nfs_set_verifier_locked(struct dentry *dentry, unsigned long verf)
{ {
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
struct inode *dir = d_inode(dentry->d_parent);
if (!nfs_verifier_is_delegated(dentry) && if (!nfs_verify_change_attribute(dir, verf))
!nfs_verify_change_attribute(d_inode(dentry->d_parent), verf)) return;
goto out;
if (inode && NFS_PROTO(inode)->have_delegation(inode, FMODE_READ)) if (inode && NFS_PROTO(inode)->have_delegation(inode, FMODE_READ))
nfs_set_verifier_delegated(&verf); nfs_set_verifier_delegated(&verf);
out:
dentry->d_time = verf; dentry->d_time = verf;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment