aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/9p/vfs_inode.c16
-rw-r--r--fs/9p/vfs_inode_dotl.c12
2 files changed, 15 insertions, 13 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index c6cef2495f00..0afbbb450faf 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -971,6 +971,10 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
971 struct p9_wstat wstat; 971 struct p9_wstat wstat;
972 972
973 P9_DPRINTK(P9_DEBUG_VFS, "\n"); 973 P9_DPRINTK(P9_DEBUG_VFS, "\n");
974 retval = inode_change_ok(dentry->d_inode, iattr);
975 if (retval)
976 return retval;
977
974 retval = -EPERM; 978 retval = -EPERM;
975 v9ses = v9fs_inode2v9ses(dentry->d_inode); 979 v9ses = v9fs_inode2v9ses(dentry->d_inode);
976 fid = v9fs_fid_lookup(dentry); 980 fid = v9fs_fid_lookup(dentry);
@@ -997,12 +1001,7 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
997 if (iattr->ia_valid & ATTR_GID) 1001 if (iattr->ia_valid & ATTR_GID)
998 wstat.n_gid = iattr->ia_gid; 1002 wstat.n_gid = iattr->ia_gid;
999 } 1003 }
1000 if ((iattr->ia_valid & ATTR_SIZE) && 1004
1001 iattr->ia_size != i_size_read(dentry->d_inode)) {
1002 retval = vmtruncate(dentry->d_inode, iattr->ia_size);
1003 if (retval)
1004 return retval;
1005 }
1006 /* Write all dirty data */ 1005 /* Write all dirty data */
1007 if (S_ISREG(dentry->d_inode->i_mode)) 1006 if (S_ISREG(dentry->d_inode->i_mode))
1008 filemap_write_and_wait(dentry->d_inode->i_mapping); 1007 filemap_write_and_wait(dentry->d_inode->i_mapping);
@@ -1010,6 +1009,11 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
1010 retval = p9_client_wstat(fid, &wstat); 1009 retval = p9_client_wstat(fid, &wstat);
1011 if (retval < 0) 1010 if (retval < 0)
1012 return retval; 1011 return retval;
1012
1013 if ((iattr->ia_valid & ATTR_SIZE) &&
1014 iattr->ia_size != i_size_read(dentry->d_inode))
1015 truncate_setsize(dentry->d_inode, iattr->ia_size);
1016
1013 v9fs_invalidate_inode_attr(dentry->d_inode); 1017 v9fs_invalidate_inode_attr(dentry->d_inode);
1014 1018
1015 setattr_copy(dentry->d_inode, iattr); 1019 setattr_copy(dentry->d_inode, iattr);
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) {