aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
authorPeng Tao <bergwolf@gmail.com>2010-10-17 01:07:46 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-06-15 11:24:28 -0400
commit0f66b5984df2fe1617c05900a39a7ef493ca9de9 (patch)
tree682ad324d9cfab94ffde805c6ca0372f7f40d3d3 /fs/nfs/inode.c
parent0b760113a3a155269a3fba93a409c640031dd68f (diff)
NFS41: do not update isize if inode needs layoutcommit
nfs_update_inode will update isize if there is no queued pages. For pNFS, layoutcommit is supposed to change file size on server, the same effect as queued pages. nfs_update_inode may be called when dirty pages are written back (nfsi->npages==0) but layoutcommit is not sent, and it will change client file size according to server file size. Then client ends up losing what it just writes back in pNFS path. So we should skip updating client file size if file needs layoutcommit. Signed-off-by: Peng Tao <peng_tao@emc.com> Cc: stable@kernel.org [2.6.39] Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 144f2a3c7185..3f1eb8180373 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1294,7 +1294,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
1294 if (new_isize != cur_isize) { 1294 if (new_isize != cur_isize) {
1295 /* Do we perhaps have any outstanding writes, or has 1295 /* Do we perhaps have any outstanding writes, or has
1296 * the file grown beyond our last write? */ 1296 * the file grown beyond our last write? */
1297 if (nfsi->npages == 0 || new_isize > cur_isize) { 1297 if ((nfsi->npages == 0 && !test_bit(NFS_INO_LAYOUTCOMMIT, &nfsi->flags)) ||
1298 new_isize > cur_isize) {
1298 i_size_write(inode, new_isize); 1299 i_size_write(inode, new_isize);
1299 invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA; 1300 invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA;
1300 } 1301 }