aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-10-20 02:28:40 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-20 13:26:39 -0400
commitcd9ae2b6a75bb1fa0d370929c2d7a7da1ed719d9 (patch)
tree1bf943b54f47bfbf5198b08b930bd09099ff99b7 /fs/nfs/inode.c
parent13bbc06af8a5f65df0f888b442e557c617cadba7 (diff)
[PATCH] NFS: Deal with failure of invalidate_inode_pages2()
If invalidate_inode_pages2() fails, then it should in principle just be because the current process was signalled. In that case, we just want to ensure that the inode's page cache remains marked as invalid. Also add a helper to allow the O_DIRECT code to simply mark the page cache as invalid once it is finished writing, instead of calling invalidate_inode_pages2() itself. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c28
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
134void 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
134static void nfs_zap_acl_cache(struct inode *inode) 143static 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 }
711out:
694 return ret; 712 return ret;
695} 713}
696 714