NFSv4: Ensure the inode is clean when we set a delegation
authorTrond Myklebust <trond.myklebust@primarydata.com>
Sat, 7 Apr 2018 22:43:17 +0000 (18:43 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 4 Jun 2018 19:03:58 +0000 (15:03 -0400)
If there are attributes that are still invalid when we set a delegation,
then we need to set the NFS_INO_REVAL_FORCED flag.

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

index 105b0f39a5b2ddc202627b15bcaa8c02b8ec299d..91c3737d69df7f0fe70f0dc35d1be96408a6614f 100644 (file)
@@ -404,6 +404,10 @@ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred,
 
        trace_nfs4_set_delegation(inode, type);
 
+       spin_lock(&inode->i_lock);
+       if (NFS_I(inode)->cache_validity & (NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ATIME))
+               NFS_I(inode)->cache_validity |= NFS_INO_REVAL_FORCED;
+       spin_unlock(&inode->i_lock);
 out:
        spin_unlock(&clp->cl_lock);
        if (delegation != NULL)