diff options
Diffstat (limited to 'fs/gfs2/ops_inode.c')
| -rw-r--r-- | fs/gfs2/ops_inode.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c index 98cdd05f3316..1009be2c9737 100644 --- a/fs/gfs2/ops_inode.c +++ b/fs/gfs2/ops_inode.c | |||
| @@ -1072,7 +1072,7 @@ int gfs2_permission(struct inode *inode, int mask) | |||
| 1072 | } | 1072 | } |
| 1073 | 1073 | ||
| 1074 | /* | 1074 | /* |
| 1075 | * XXX: should be changed to have proper ordering by opencoding simple_setsize | 1075 | * XXX(truncate): the truncate_setsize calls should be moved to the end. |
| 1076 | */ | 1076 | */ |
| 1077 | static int setattr_size(struct inode *inode, struct iattr *attr) | 1077 | static int setattr_size(struct inode *inode, struct iattr *attr) |
| 1078 | { | 1078 | { |
| @@ -1084,10 +1084,8 @@ static int setattr_size(struct inode *inode, struct iattr *attr) | |||
| 1084 | error = gfs2_trans_begin(sdp, 0, sdp->sd_jdesc->jd_blocks); | 1084 | error = gfs2_trans_begin(sdp, 0, sdp->sd_jdesc->jd_blocks); |
| 1085 | if (error) | 1085 | if (error) |
| 1086 | return error; | 1086 | return error; |
| 1087 | error = simple_setsize(inode, attr->ia_size); | 1087 | truncate_setsize(inode, attr->ia_size); |
| 1088 | gfs2_trans_end(sdp); | 1088 | gfs2_trans_end(sdp); |
| 1089 | if (error) | ||
| 1090 | return error; | ||
| 1091 | } | 1089 | } |
| 1092 | 1090 | ||
| 1093 | error = gfs2_truncatei(ip, attr->ia_size); | 1091 | error = gfs2_truncatei(ip, attr->ia_size); |
| @@ -1136,8 +1134,16 @@ static int setattr_chown(struct inode *inode, struct iattr *attr) | |||
| 1136 | if (error) | 1134 | if (error) |
| 1137 | goto out_end_trans; | 1135 | goto out_end_trans; |
| 1138 | 1136 | ||
| 1139 | error = inode_setattr(inode, attr); | 1137 | if ((attr->ia_valid & ATTR_SIZE) && |
| 1140 | gfs2_assert_warn(sdp, !error); | 1138 | attr->ia_size != i_size_read(inode)) { |
| 1139 | int error; | ||
| 1140 | |||
| 1141 | error = vmtruncate(inode, attr->ia_size); | ||
| 1142 | gfs2_assert_warn(sdp, !error); | ||
| 1143 | } | ||
| 1144 | |||
| 1145 | setattr_copy(inode, attr); | ||
| 1146 | mark_inode_dirty(inode); | ||
| 1141 | 1147 | ||
| 1142 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); | 1148 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); |
| 1143 | gfs2_dinode_out(ip, dibh->b_data); | 1149 | gfs2_dinode_out(ip, dibh->b_data); |
