summaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
authorJeff Layton2014-01-28 19:47:46 +0100
committerTrond Myklebust2014-01-28 20:48:18 +0100
commit4db72b40fdbc706f8957e9773ae73b1574b8c694 (patch)
tree7ccf6324c0643b0b35c1ccc0895292f51000685e /fs/nfs/inode.c
parentNFS: Fix races in nfs_revalidate_mapping (diff)
downloadkernel-qcow2-linux-4db72b40fdbc706f8957e9773ae73b1574b8c694.tar.gz
kernel-qcow2-linux-4db72b40fdbc706f8957e9773ae73b1574b8c694.tar.xz
kernel-qcow2-linux-4db72b40fdbc706f8957e9773ae73b1574b8c694.zip
nfs: add memory barriers around NFS_INO_INVALID_DATA and NFS_INO_INVALIDATING
If the setting of NFS_INO_INVALIDATING gets reordered to before the clearing of NFS_INO_INVALID_DATA, then another task may hit a race window where both appear to be clear, even though the inode's pages are still in need of invalidation. Fix this by adding the appropriate memory barriers. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index e5070aa5f175..02e185168602 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1050,6 +1050,7 @@ int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping)
}
set_bit(NFS_INO_INVALIDATING, bitlock);
+ smp_wmb();
nfsi->cache_validity &= ~NFS_INO_INVALID_DATA;
spin_unlock(&inode->i_lock);
trace_nfs_invalidate_mapping_enter(inode);