summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaokun Li <libaokun1@huawei.com>2024-08-22 10:35:30 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-10-17 15:21:53 +0200
commit2060abdede3a639ec9493344a3711c88a996e112 (patch)
treed9bcd22849ac5748415578690a1ac63e047e4fb7
parenta5401d4c3e2a3d25643c567d26e6de327774a2c9 (diff)
downloadlinux-2060abdede3a639ec9493344a3711c88a996e112.tar.gz
linux-2060abdede3a639ec9493344a3711c88a996e112.tar.bz2
linux-2060abdede3a639ec9493344a3711c88a996e112.zip
ext4: propagate errors from ext4_find_extent() in ext4_insert_range()
commit 369c944ed1d7c3fb7b35f24e4735761153afe7b3 upstream. 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: 331573febb6a ("ext4: Add support FALLOC_FL_INSERT_RANGE for fallocate") Cc: stable@kernel.org Signed-off-by: Baokun Li <libaokun1@huawei.com> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com> Tested-by: Ojaswin Mujoo <ojaswin@linux.ibm.com> Link: https://patch.msgid.link/20240822023545.1994557-11-libaokun@huaweicloud.com Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/ext4/extents.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 82d4e6587c31..b1cd036c650a 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -5570,6 +5570,7 @@ static int ext4_insert_range(struct file *file, loff_t offset, loff_t len)
path = ext4_find_extent(inode, offset_lblk, NULL, 0);
if (IS_ERR(path)) {
up_write(&EXT4_I(inode)->i_data_sem);
+ ret = PTR_ERR(path);
goto out_stop;
}