aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 20:29:02 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 20:29:02 -0500
commita6a852e93705121e2b90bd41ad50e85a508699aa (patch)
tree5454fe74c5edd4c8cf3658f1dff10005ff34d113
parent099dc4fb62653f6019d78db55fba7a18ef02d65b (diff)
parent3211e4eb5834924dd5beac8956c0bc0bfb755c37 (diff)
Merge git://git.linux-nfs.org/pub/linux/nfs-2.6
* git://git.linux-nfs.org/pub/linux/nfs-2.6: SUNRPC xptrdma: simplify build configuration NFS: Fix a potential file corruption issue when writing
-rw-r--r--fs/Kconfig7
-rw-r--r--fs/nfs/write.c20
2 files changed, 19 insertions, 8 deletions
diff --git a/fs/Kconfig b/fs/Kconfig
index 3bf6ace1720c..d7312825592b 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -1778,12 +1778,9 @@ config SUNRPC_GSS
1778 tristate 1778 tristate
1779 1779
1780config SUNRPC_XPRT_RDMA 1780config SUNRPC_XPRT_RDMA
1781 tristate "RDMA transport for sunrpc (EXPERIMENTAL)" 1781 tristate
1782 depends on SUNRPC && INFINIBAND && EXPERIMENTAL 1782 depends on SUNRPC && INFINIBAND && EXPERIMENTAL
1783 default m 1783 default SUNRPC && INFINIBAND
1784 help
1785 Adds a client RPC transport for supporting kernel NFS over RDMA
1786 mounts, including Infiniband and iWARP. Experimental.
1787 1784
1788config SUNRPC_BIND34 1785config SUNRPC_BIND34
1789 bool "Support for rpcbind versions 3 & 4 (EXPERIMENTAL)" 1786 bool "Support for rpcbind versions 3 & 4 (EXPERIMENTAL)"
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index b144b1957dd9..f55c437124a2 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -697,6 +697,17 @@ int nfs_flush_incompatible(struct file *file, struct page *page)
697} 697}
698 698
699/* 699/*
700 * If the page cache is marked as unsafe or invalid, then we can't rely on
701 * the PageUptodate() flag. In this case, we will need to turn off
702 * write optimisations that depend on the page contents being correct.
703 */
704static int nfs_write_pageuptodate(struct page *page, struct inode *inode)
705{
706 return PageUptodate(page) &&
707 !(NFS_I(inode)->cache_validity & (NFS_INO_REVAL_PAGECACHE|NFS_INO_INVALID_DATA));
708}
709
710/*
700 * Update and possibly write a cached page of an NFS file. 711 * Update and possibly write a cached page of an NFS file.
701 * 712 *
702 * XXX: Keep an eye on generic_file_read to make sure it doesn't do bad 713 * XXX: Keep an eye on generic_file_read to make sure it doesn't do bad
@@ -717,10 +728,13 @@ int nfs_updatepage(struct file *file, struct page *page,
717 (long long)(page_offset(page) +offset)); 728 (long long)(page_offset(page) +offset));
718 729
719 /* If we're not using byte range locks, and we know the page 730 /* If we're not using byte range locks, and we know the page
720 * is entirely in cache, it may be more efficient to avoid 731 * is up to date, it may be more efficient to extend the write
721 * fragmenting write requests. 732 * to cover the entire page in order to avoid fragmentation
733 * inefficiencies.
722 */ 734 */
723 if (PageUptodate(page) && inode->i_flock == NULL && !(file->f_mode & O_SYNC)) { 735 if (nfs_write_pageuptodate(page, inode) &&
736 inode->i_flock == NULL &&
737 !(file->f_mode & O_SYNC)) {
724 count = max(count + offset, nfs_page_length(page)); 738 count = max(count + offset, nfs_page_length(page));
725 offset = 0; 739 offset = 0;
726 } 740 }