From: Trond Myklebust Date: Wed, 15 Aug 2007 12:55:32 -0400 NFS: Add memory barriers to nfs_revalidate_inode() and friends We need to ensure that all inode metadata reads complete before the call to nfs_revalidate_inode(). Signed-off-by: Trond Myklebust --- fs/nfs/inode.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 721e511..99899fb 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -668,6 +668,7 @@ int nfs_attribute_timeout(struct inode *inode) */ int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) { + smp_rmb(); if (!(NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATTR) && !nfs_attribute_timeout(inode)) return NFS_STALE(inode) ? -ESTALE : 0; @@ -721,6 +722,7 @@ int nfs_revalidate_mapping_nolock(struct inode *inode, struct address_space *map struct nfs_inode *nfsi = NFS_I(inode); int ret = 0; + smp_rmb(); if ((nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE) || nfs_attribute_timeout(inode) || NFS_STALE(inode)) { ret = __nfs_revalidate_inode(NFS_SERVER(inode), inode); @@ -746,6 +748,7 @@ int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping) struct nfs_inode *nfsi = NFS_I(inode); int ret = 0; + smp_rmb(); if ((nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE) || nfs_attribute_timeout(inode) || NFS_STALE(inode)) { ret = __nfs_revalidate_inode(NFS_SERVER(inode), inode); @@ -786,6 +789,7 @@ void nfs_end_data_update(struct inode *inode) spin_unlock(&inode->i_lock); } nfsi->cache_change_attribute = jiffies; + smp_wmb(); atomic_dec(&nfsi->data_updates); }