diff options
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/inode.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 6348c1f610c2..d98b033dd4a4 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -5309,8 +5309,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr) | |||
5309 | 5309 | ||
5310 | if (S_ISREG(inode->i_mode) && | 5310 | if (S_ISREG(inode->i_mode) && |
5311 | attr->ia_valid & ATTR_SIZE && | 5311 | attr->ia_valid & ATTR_SIZE && |
5312 | (attr->ia_size < inode->i_size || | 5312 | (attr->ia_size < inode->i_size)) { |
5313 | (ext4_test_inode_flag(inode, EXT4_INODE_EOFBLOCKS)))) { | ||
5314 | handle_t *handle; | 5313 | handle_t *handle; |
5315 | 5314 | ||
5316 | handle = ext4_journal_start(inode, 3); | 5315 | handle = ext4_journal_start(inode, 3); |
@@ -5344,14 +5343,15 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr) | |||
5344 | goto err_out; | 5343 | goto err_out; |
5345 | } | 5344 | } |
5346 | } | 5345 | } |
5347 | /* ext4_truncate will clear the flag */ | ||
5348 | if ((ext4_test_inode_flag(inode, EXT4_INODE_EOFBLOCKS))) | ||
5349 | ext4_truncate(inode); | ||
5350 | } | 5346 | } |
5351 | 5347 | ||
5352 | if ((attr->ia_valid & ATTR_SIZE) && | 5348 | if (attr->ia_valid & ATTR_SIZE) { |
5353 | attr->ia_size != i_size_read(inode)) | 5349 | if (attr->ia_size != i_size_read(inode)) { |
5354 | rc = vmtruncate(inode, attr->ia_size); | 5350 | truncate_setsize(inode, attr->ia_size); |
5351 | ext4_truncate(inode); | ||
5352 | } else if (ext4_test_inode_flag(inode, EXT4_INODE_EOFBLOCKS)) | ||
5353 | ext4_truncate(inode); | ||
5354 | } | ||
5355 | 5355 | ||
5356 | if (!rc) { | 5356 | if (!rc) { |
5357 | setattr_copy(inode, attr); | 5357 | setattr_copy(inode, attr); |