diff options
Diffstat (limited to 'fs/nfs/inode.c')
| -rw-r--r-- | fs/nfs/inode.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index bc9376ca86cd..08cc4c5919ab 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 *); |
| @@ -574,7 +583,7 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) | |||
| 574 | 583 | ||
| 575 | nfs_inc_stats(inode, NFSIOS_INODEREVALIDATE); | 584 | nfs_inc_stats(inode, NFSIOS_INODEREVALIDATE); |
| 576 | lock_kernel(); | 585 | lock_kernel(); |
| 577 | if (!inode || is_bad_inode(inode)) | 586 | if (is_bad_inode(inode)) |
| 578 | goto out_nowait; | 587 | goto out_nowait; |
| 579 | if (NFS_STALE(inode)) | 588 | if (NFS_STALE(inode)) |
| 580 | goto out_nowait; | 589 | goto out_nowait; |
| @@ -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 | ||
