Skip to content

Commit 369c944

Browse files
LiBaokun96tytso
authored andcommitted
ext4: propagate errors from ext4_find_extent() in ext4_insert_range()
Even though ext4_find_extent() returns an error, ext4_insert_range() still returns 0. This may confuse the user as to why fallocate returns success, but the contents of the file are not as expected. So propagate the error returned by ext4_find_extent() to avoid inconsistencies. Fixes: 331573f ("ext4: Add support FALLOC_FL_INSERT_RANGE for fallocate") Cc: [email protected] Signed-off-by: Baokun Li <[email protected]> Reviewed-by: Jan Kara <[email protected]> Reviewed-by: Ojaswin Mujoo <[email protected]> Tested-by: Ojaswin Mujoo <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 6c2b324 commit 369c944

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/ext4/extents.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5541,6 +5541,7 @@ static int ext4_insert_range(struct file *file, loff_t offset, loff_t len)
55415541
path = ext4_find_extent(inode, offset_lblk, NULL, 0);
55425542
if (IS_ERR(path)) {
55435543
up_write(&EXT4_I(inode)->i_data_sem);
5544+
ret = PTR_ERR(path);
55445545
goto out_stop;
55455546
}
55465547

0 commit comments

Comments
 (0)