Skip to content

Commit

Permalink
Merge git://git.linux-nfs.org/pub/linux/nfs-2.6
Browse files Browse the repository at this point in the history
* git://git.linux-nfs.org/pub/linux/nfs-2.6:
  SUNRPC xptrdma: simplify build configuration
  NFS: Fix a potential file corruption issue when writing
  • Loading branch information
Linus Torvalds committed Feb 8, 2008
2 parents 099dc4f + 3211e4e commit a6a852e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
7 changes: 2 additions & 5 deletions fs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1778,12 +1778,9 @@ config SUNRPC_GSS
tristate

config SUNRPC_XPRT_RDMA
tristate "RDMA transport for sunrpc (EXPERIMENTAL)"
tristate
depends on SUNRPC && INFINIBAND && EXPERIMENTAL
default m
help
Adds a client RPC transport for supporting kernel NFS over RDMA
mounts, including Infiniband and iWARP. Experimental.
default SUNRPC && INFINIBAND

config SUNRPC_BIND34
bool "Support for rpcbind versions 3 & 4 (EXPERIMENTAL)"
Expand Down
20 changes: 17 additions & 3 deletions fs/nfs/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,17 @@ int nfs_flush_incompatible(struct file *file, struct page *page)
return status;
}

/*
* If the page cache is marked as unsafe or invalid, then we can't rely on
* the PageUptodate() flag. In this case, we will need to turn off
* write optimisations that depend on the page contents being correct.
*/
static int nfs_write_pageuptodate(struct page *page, struct inode *inode)
{
return PageUptodate(page) &&
!(NFS_I(inode)->cache_validity & (NFS_INO_REVAL_PAGECACHE|NFS_INO_INVALID_DATA));
}

/*
* Update and possibly write a cached page of an NFS file.
*
Expand All @@ -717,10 +728,13 @@ int nfs_updatepage(struct file *file, struct page *page,
(long long)(page_offset(page) +offset));

/* If we're not using byte range locks, and we know the page
* is entirely in cache, it may be more efficient to avoid
* fragmenting write requests.
* is up to date, it may be more efficient to extend the write
* to cover the entire page in order to avoid fragmentation
* inefficiencies.
*/
if (PageUptodate(page) && inode->i_flock == NULL && !(file->f_mode & O_SYNC)) {
if (nfs_write_pageuptodate(page, inode) &&
inode->i_flock == NULL &&
!(file->f_mode & O_SYNC)) {
count = max(count + offset, nfs_page_length(page));
offset = 0;
}
Expand Down

0 comments on commit a6a852e

Please sign in to comment.