aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/direct.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/direct.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/direct.c')
-rw-r--r--fs/nfs/direct.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 1e873fcab947..bdfabf854a51 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -497,6 +497,7 @@ static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode
497 if (dreq->commit_data != NULL) 497 if (dreq->commit_data != NULL)
498 nfs_commit_free(dreq->commit_data); 498 nfs_commit_free(dreq->commit_data);
499 nfs_direct_free_writedata(dreq); 499 nfs_direct_free_writedata(dreq);
500 nfs_zap_mapping(inode, inode->i_mapping);
500 nfs_direct_complete(dreq); 501 nfs_direct_complete(dreq);
501 } 502 }
502} 503}
@@ -517,6 +518,7 @@ static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode
517{ 518{
518 nfs_end_data_update(inode); 519 nfs_end_data_update(inode);
519 nfs_direct_free_writedata(dreq); 520 nfs_direct_free_writedata(dreq);
521 nfs_zap_mapping(inode, inode->i_mapping);
520 nfs_direct_complete(dreq); 522 nfs_direct_complete(dreq);
521} 523}
522#endif 524#endif
@@ -830,17 +832,6 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
830 832
831 retval = nfs_direct_write(iocb, (unsigned long) buf, count, pos); 833 retval = nfs_direct_write(iocb, (unsigned long) buf, count, pos);
832 834
833 /*
834 * XXX: nfs_end_data_update() already ensures this file's
835 * cached data is subsequently invalidated. Do we really
836 * need to call invalidate_inode_pages2() again here?
837 *
838 * For aio writes, this invalidation will almost certainly
839 * occur before the writes complete. Kind of racey.
840 */
841 if (mapping->nrpages)
842 invalidate_inode_pages2(mapping);
843
844 if (retval > 0) 835 if (retval > 0)
845 iocb->ki_pos = pos + retval; 836 iocb->ki_pos = pos + retval;
846 837