diff options
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r-- | fs/nfs/inode.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index bc9376ca86cd..9979ad1cf8eb 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -131,6 +131,15 @@ void nfs_zap_caches(struct inode *inode) | |||
131 | spin_unlock(&inode->i_lock); | 131 | spin_unlock(&inode->i_lock); |
132 | } | 132 | } |
133 | 133 | ||
134 | void nfs_zap_mapping(struct inode *inode, struct address_space *mapping) | ||
135 | { | ||
136 | if (mapping->nrpages != 0) { | ||
137 | spin_lock(&inode->i_lock); | ||
138 | NFS_I(inode)->cache_validity |= NFS_INO_INVALID_DATA; | ||
139 | spin_unlock(&inode->i_lock); | ||
140 | } | ||
141 | } | ||
142 | |||
134 | static void nfs_zap_acl_cache(struct inode *inode) | 143 | static void nfs_zap_acl_cache(struct inode *inode) |
135 | { | 144 | { |
136 | void (*clear_acl_cache)(struct inode *); | 145 | void (*clear_acl_cache)(struct inode *); |
@@ -671,13 +680,20 @@ int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping) | |||
671 | if ((nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE) | 680 | if ((nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE) |
672 | || nfs_attribute_timeout(inode)) | 681 | || nfs_attribute_timeout(inode)) |
673 | ret = __nfs_revalidate_inode(NFS_SERVER(inode), inode); | 682 | ret = __nfs_revalidate_inode(NFS_SERVER(inode), inode); |
683 | if (ret < 0) | ||
684 | goto out; | ||
674 | 685 | ||
675 | if (nfsi->cache_validity & NFS_INO_INVALID_DATA) { | 686 | if (nfsi->cache_validity & NFS_INO_INVALID_DATA) { |
676 | nfs_inc_stats(inode, NFSIOS_DATAINVALIDATE); | 687 | if (mapping->nrpages != 0) { |
677 | if (S_ISREG(inode->i_mode)) | 688 | if (S_ISREG(inode->i_mode)) { |
678 | nfs_sync_mapping(mapping); | 689 | ret = nfs_sync_mapping(mapping); |
679 | invalidate_inode_pages2(mapping); | 690 | if (ret < 0) |
680 | 691 | goto out; | |
692 | } | ||
693 | ret = invalidate_inode_pages2(mapping); | ||
694 | if (ret < 0) | ||
695 | goto out; | ||
696 | } | ||
681 | spin_lock(&inode->i_lock); | 697 | spin_lock(&inode->i_lock); |
682 | nfsi->cache_validity &= ~NFS_INO_INVALID_DATA; | 698 | nfsi->cache_validity &= ~NFS_INO_INVALID_DATA; |
683 | if (S_ISDIR(inode->i_mode)) { | 699 | if (S_ISDIR(inode->i_mode)) { |
@@ -687,10 +703,12 @@ int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping) | |||
687 | } | 703 | } |
688 | spin_unlock(&inode->i_lock); | 704 | spin_unlock(&inode->i_lock); |
689 | 705 | ||
706 | nfs_inc_stats(inode, NFSIOS_DATAINVALIDATE); | ||
690 | dfprintk(PAGECACHE, "NFS: (%s/%Ld) data cache invalidated\n", | 707 | dfprintk(PAGECACHE, "NFS: (%s/%Ld) data cache invalidated\n", |
691 | inode->i_sb->s_id, | 708 | inode->i_sb->s_id, |
692 | (long long)NFS_FILEID(inode)); | 709 | (long long)NFS_FILEID(inode)); |
693 | } | 710 | } |
711 | out: | ||
694 | return ret; | 712 | return ret; |
695 | } | 713 | } |
696 | 714 | ||