aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p/vfs_inode_dotl.c
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2011-03-08 06:09:48 -0500
committerEric Van Hensbergen <ericvh@gmail.com>2011-03-22 16:43:35 -0400
commit059c138bc79320bd7d6fba91bad4d50eeec9c31f (patch)
tree0ec60c1a30863ff20029043b14909d02aadc696e /fs/9p/vfs_inode_dotl.c
parent472e7f9f8b547605ee9670ac803e971c2e3eeac0 (diff)
fs/9p: Use truncate_setsize instead of vmtruncate
convert vmtruncate usage to truncate_setsize. We also writeback all dirty pages before doing 9p operations and on success call truncate_setsize. This ensure that we continue sanely on failed truncate on the server. The disadvantage is that we are now going to write back the content that get thrown away later as a part of truncate. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p/vfs_inode_dotl.c')
-rw-r--r--fs/9p/vfs_inode_dotl.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 327c578c7ba6..0a0ac30d51d6 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -456,12 +456,6 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
456 if (IS_ERR(fid)) 456 if (IS_ERR(fid))
457 return PTR_ERR(fid); 457 return PTR_ERR(fid);
458 458
459 if ((iattr->ia_valid & ATTR_SIZE) &&
460 iattr->ia_size != i_size_read(dentry->d_inode)) {
461 retval = vmtruncate(dentry->d_inode, iattr->ia_size);
462 if (retval)
463 return retval;
464 }
465 /* Write all dirty data */ 459 /* Write all dirty data */
466 if (S_ISREG(dentry->d_inode->i_mode)) 460 if (S_ISREG(dentry->d_inode->i_mode))
467 filemap_write_and_wait(dentry->d_inode->i_mapping); 461 filemap_write_and_wait(dentry->d_inode->i_mapping);
@@ -469,8 +463,12 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
469 retval = p9_client_setattr(fid, &p9attr); 463 retval = p9_client_setattr(fid, &p9attr);
470 if (retval < 0) 464 if (retval < 0)
471 return retval; 465 return retval;
472 v9fs_invalidate_inode_attr(dentry->d_inode);
473 466
467 if ((iattr->ia_valid & ATTR_SIZE) &&
468 iattr->ia_size != i_size_read(dentry->d_inode))
469 truncate_setsize(dentry->d_inode, iattr->ia_size);
470
471 v9fs_invalidate_inode_attr(dentry->d_inode);
474 setattr_copy(dentry->d_inode, iattr); 472 setattr_copy(dentry->d_inode, iattr);
475 mark_inode_dirty(dentry->d_inode); 473 mark_inode_dirty(dentry->d_inode);
476 if (iattr->ia_valid & ATTR_MODE) { 474 if (iattr->ia_valid & ATTR_MODE) {