]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
NFS: Fix fscache invalidation in nfs_set_cache_invalid()
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Fri, 26 Mar 2021 20:23:39 +0000 (16:23 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 May 2021 09:43:46 +0000 (11:43 +0200)
[ Upstream commit beab450d8ea93cdf4c6cb7714bdc31a9e0f34738 ]

Ensure that we invalidate the fscache before we strip the
NFS_INO_INVALID_DATA flag.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/inode.c

index 7cfeee3eeef7f5c32f12ba259adb340c445e3fe8..8de5b3b9da91a9b52fb554b6e45e9b381d5f11b9 100644 (file)
@@ -223,11 +223,11 @@ void nfs_set_cache_invalid(struct inode *inode, unsigned long flags)
 
        if (!nfs_has_xattr_cache(nfsi))
                flags &= ~NFS_INO_INVALID_XATTR;
+       if (flags & NFS_INO_INVALID_DATA)
+               nfs_fscache_invalidate(inode);
        if (inode->i_mapping->nrpages == 0)
                flags &= ~(NFS_INO_INVALID_DATA|NFS_INO_DATA_INVAL_DEFER);
        nfsi->cache_validity |= flags;
-       if (flags & NFS_INO_INVALID_DATA)
-               nfs_fscache_invalidate(inode);
 }
 EXPORT_SYMBOL_GPL(nfs_set_cache_invalid);