diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2011-02-28 06:34:10 -0500 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2011-03-15 10:57:42 -0400 |
commit | f10fc50f1adaf40fdd5da6dd154ecb464b468e2f (patch) | |
tree | 254b9ea1aebb08b1bae37557aa7f7ea39b78d05c /fs/9p/vfs_inode.c | |
parent | c06c066a083aa0a336d6b2b1ed502dd0b8488ac7 (diff) |
fs/9p: call vmtruncate before setattr 9p opeation
We need to call vmtruncate before 9p setattr operation, otherwise we
could write back some dirty pages between setattr with ATTR_SIZE and vmtruncate
causing some truncated pages to be written back to server
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.c')
-rw-r--r-- | fs/9p/vfs_inode.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 524d255a5748..2555776920ad 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
@@ -993,18 +993,16 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr) | |||
993 | if (iattr->ia_valid & ATTR_GID) | 993 | if (iattr->ia_valid & ATTR_GID) |
994 | wstat.n_gid = iattr->ia_gid; | 994 | wstat.n_gid = iattr->ia_gid; |
995 | } | 995 | } |
996 | |||
997 | retval = p9_client_wstat(fid, &wstat); | ||
998 | if (retval < 0) | ||
999 | return retval; | ||
1000 | |||
1001 | v9fs_invalidate_inode_attr(dentry->d_inode); | ||
1002 | if ((iattr->ia_valid & ATTR_SIZE) && | 996 | if ((iattr->ia_valid & ATTR_SIZE) && |
1003 | iattr->ia_size != i_size_read(dentry->d_inode)) { | 997 | iattr->ia_size != i_size_read(dentry->d_inode)) { |
1004 | retval = vmtruncate(dentry->d_inode, iattr->ia_size); | 998 | retval = vmtruncate(dentry->d_inode, iattr->ia_size); |
1005 | if (retval) | 999 | if (retval) |
1006 | return retval; | 1000 | return retval; |
1007 | } | 1001 | } |
1002 | retval = p9_client_wstat(fid, &wstat); | ||
1003 | if (retval < 0) | ||
1004 | return retval; | ||
1005 | v9fs_invalidate_inode_attr(dentry->d_inode); | ||
1008 | 1006 | ||
1009 | setattr_copy(dentry->d_inode, iattr); | 1007 | setattr_copy(dentry->d_inode, iattr); |
1010 | mark_inode_dirty(dentry->d_inode); | 1008 | mark_inode_dirty(dentry->d_inode); |