Commit f10fc50f authored by Aneesh Kumar K.V's avatar Aneesh Kumar K.V Committed by Eric Van Hensbergen
Browse files

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: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: default avatarVenkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
parent c06c066a
...@@ -993,18 +993,16 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr) ...@@ -993,18 +993,16 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
if (iattr->ia_valid & ATTR_GID) if (iattr->ia_valid & ATTR_GID)
wstat.n_gid = iattr->ia_gid; wstat.n_gid = iattr->ia_gid;
} }
retval = p9_client_wstat(fid, &wstat);
if (retval < 0)
return retval;
v9fs_invalidate_inode_attr(dentry->d_inode);
if ((iattr->ia_valid & ATTR_SIZE) && if ((iattr->ia_valid & ATTR_SIZE) &&
iattr->ia_size != i_size_read(dentry->d_inode)) { iattr->ia_size != i_size_read(dentry->d_inode)) {
retval = vmtruncate(dentry->d_inode, iattr->ia_size); retval = vmtruncate(dentry->d_inode, iattr->ia_size);
if (retval) if (retval)
return retval; return retval;
} }
retval = p9_client_wstat(fid, &wstat);
if (retval < 0)
return retval;
v9fs_invalidate_inode_attr(dentry->d_inode);
setattr_copy(dentry->d_inode, iattr); setattr_copy(dentry->d_inode, iattr);
mark_inode_dirty(dentry->d_inode); mark_inode_dirty(dentry->d_inode);
......
...@@ -453,17 +453,16 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr) ...@@ -453,17 +453,16 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
if (IS_ERR(fid)) if (IS_ERR(fid))
return PTR_ERR(fid); return PTR_ERR(fid);
retval = p9_client_setattr(fid, &p9attr);
if (retval < 0)
return retval;
v9fs_invalidate_inode_attr(dentry->d_inode);
if ((iattr->ia_valid & ATTR_SIZE) && if ((iattr->ia_valid & ATTR_SIZE) &&
iattr->ia_size != i_size_read(dentry->d_inode)) { iattr->ia_size != i_size_read(dentry->d_inode)) {
retval = vmtruncate(dentry->d_inode, iattr->ia_size); retval = vmtruncate(dentry->d_inode, iattr->ia_size);
if (retval) if (retval)
return retval; return retval;
} }
retval = p9_client_setattr(fid, &p9attr);
if (retval < 0)
return retval;
v9fs_invalidate_inode_attr(dentry->d_inode);
setattr_copy(dentry->d_inode, iattr); setattr_copy(dentry->d_inode, iattr);
mark_inode_dirty(dentry->d_inode); mark_inode_dirty(dentry->d_inode);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment