]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
NFSv4: Optimise away forced revalidation when we know the attributes are OK
authorTrond Myklebust <trond.myklebust@primarydata.com>
Thu, 27 Oct 2016 22:42:04 +0000 (18:42 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Thu, 1 Dec 2016 22:21:37 +0000 (17:21 -0500)
The NFS_INO_REVAL_FORCED flag needs to be set if we just got a delegation,
and we see that there might still be some ambiguity as to whether or not
our attribute or data cache are valid.
In practice, this means that a call to nfs_check_inode_attributes() will
have noticed a discrepancy between cached attributes and measured ones,
so let's move the setting of NFS_INO_REVAL_FORCED to there.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/delegation.c
fs/nfs/inode.c

index dff600ae0d7477333a3e41749cffe58ad77c7e3a..d7df5e67b0c1560ff3ea93cccd6a4b21e066cd88 100644 (file)
@@ -391,10 +391,6 @@ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct
        rcu_assign_pointer(nfsi->delegation, delegation);
        delegation = NULL;
 
-       /* Ensure we revalidate the attributes and page cache! */
-       spin_lock(&inode->i_lock);
-       nfsi->cache_validity |= NFS_INO_REVAL_FORCED;
-       spin_unlock(&inode->i_lock);
        trace_nfs4_set_delegation(inode, res->delegation_type);
 
 out:
index bf4ec5ecc97e4571e3f971222c71f0519874682a..3575e3408bd7dc58cbb97a34b31a0ea25fcab907 100644 (file)
@@ -1317,7 +1317,7 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat
                invalid |= NFS_INO_INVALID_ATIME;
 
        if (invalid != 0)
-               nfs_set_cache_invalid(inode, invalid);
+               nfs_set_cache_invalid(inode, invalid | NFS_INO_REVAL_FORCED);
 
        nfsi->read_cache_jiffies = fattr->time_start;
        return 0;