Commit ae24f28d39610a4810c78185cf599a771cf6ee1f
Committed by
Theodore Ts'o
1 parent
556b27abf7
Exists in
master
and in
39 other branches
ext4: Convert ext4 to new truncate calling convention
Trivial conversion. Fixup one error handling case calling vmtruncate() and remove ->truncate callback. We also fix a bug that IS_IMMUTABLE and IS_APPEND files could not be truncated during failed writes. In fact, the test can be completely removed as upper layers do necessary permission checks for truncate in do_sys_[f]truncate() and may_open() anyway. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Showing 2 changed files with 1 additions and 4 deletions Side-by-side Diff
fs/ext4/file.c
fs/ext4/inode.c
... | ... | @@ -3511,7 +3511,7 @@ |
3511 | 3511 | loff_t end = offset + iov_length(iov, nr_segs); |
3512 | 3512 | |
3513 | 3513 | if (end > isize) |
3514 | - vmtruncate(inode, isize); | |
3514 | + ext4_truncate_failed_write(inode); | |
3515 | 3515 | } |
3516 | 3516 | } |
3517 | 3517 | if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) |
... | ... | @@ -4407,8 +4407,6 @@ |
4407 | 4407 | |
4408 | 4408 | int ext4_can_truncate(struct inode *inode) |
4409 | 4409 | { |
4410 | - if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) | |
4411 | - return 0; | |
4412 | 4410 | if (S_ISREG(inode->i_mode)) |
4413 | 4411 | return 1; |
4414 | 4412 | if (S_ISDIR(inode->i_mode)) |