diff options
author | Theodore Ts'o <tytso@mit.edu> | 2016-11-14 06:02:28 +0300 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2016-11-14 06:02:28 +0300 |
commit | d0abb36db44faaf8f8aa148ca206fe2404042dec (patch) | |
tree | ba2df0fb5b53f82725400269e6de78e0fd0042a1 /fs/ext4/extents.c | |
parent | 2c98eb5ea249767bbc11cf4e70e91d5b0458ed13 (diff) | |
download | linux-d0abb36db44faaf8f8aa148ca206fe2404042dec.tar.xz |
ext4: allow ext4_ext_truncate() to return an error
Return errors to the caller instead of declaring the file system
corrupted.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext4/extents.c')
-rw-r--r-- | fs/ext4/extents.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index c930a0110fb4..d3b119499c53 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -4631,7 +4631,7 @@ out2: return err ? err : allocated; } -void ext4_ext_truncate(handle_t *handle, struct inode *inode) +int ext4_ext_truncate(handle_t *handle, struct inode *inode) { struct super_block *sb = inode->i_sb; ext4_lblk_t last_block; @@ -4645,7 +4645,9 @@ void ext4_ext_truncate(handle_t *handle, struct inode *inode) /* we have to know where to truncate from in crash case */ EXT4_I(inode)->i_disksize = inode->i_size; - ext4_mark_inode_dirty(handle, inode); + err = ext4_mark_inode_dirty(handle, inode); + if (err) + return err; last_block = (inode->i_size + sb->s_blocksize - 1) >> EXT4_BLOCK_SIZE_BITS(sb); @@ -4657,12 +4659,9 @@ retry: congestion_wait(BLK_RW_ASYNC, HZ/50); goto retry; } - if (err) { - ext4_std_error(inode->i_sb, err); - return; - } - err = ext4_ext_remove_space(inode, last_block, EXT_MAX_BLOCKS - 1); - ext4_std_error(inode->i_sb, err); + if (err) + return err; + return ext4_ext_remove_space(inode, last_block, EXT_MAX_BLOCKS - 1); } static int ext4_alloc_file_blocks(struct file *file, ext4_lblk_t offset, |