]> git.hungrycats.org Git - linux/commitdiff
NFSv4: Force a post-op attribute update when holding a delegation
authorTrond Myklebust <trond.myklebust@primarydata.com>
Thu, 20 Aug 2015 23:56:07 +0000 (18:56 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Sep 2015 17:26:09 +0000 (19:26 +0200)
commit aaae3f00d3f67f681a1f3cb7af999e976e8a24ce upstream.

If the ctime or mtime or change attribute have changed because
of an operation we initiated, we should make sure that we force
an attribute update. However we do not want to mark the page cache
for revalidation.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfs/inode.c

index f1478544aa0cb225ddcf1aca26e958e50f311a10..976ba792fbc695199262a3ebe13abc82bc07d3a7 100644 (file)
@@ -1480,6 +1480,13 @@ static int nfs_post_op_update_inode_locked(struct inode *inode, struct nfs_fattr
 {
        unsigned long invalid = NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE;
 
+       /*
+        * Don't revalidate the pagecache if we hold a delegation, but do
+        * force an attribute update
+        */
+       if (NFS_PROTO(inode)->have_delegation(inode, FMODE_READ))
+               invalid = NFS_INO_INVALID_ATTR|NFS_INO_REVAL_FORCED;
+
        if (S_ISDIR(inode->i_mode))
                invalid |= NFS_INO_INVALID_DATA;
        nfs_set_cache_invalid(inode, invalid);