1 ext4: fix removing status extents in ext4_collapse_range()
3 From: Lukas Czerner <lczerner@redhat.com>
5 Currently in ext4_collapse_range() when calling ext4_es_remove_extent() to
6 remove status extents we're passing (EXT_MAX_BLOCKS - punch_start - 1)
7 in order to remove all extents from start of the collapse range to the
8 end of the file. However this is wrong because we might miss the
9 possible extent covering the last block of the file.
11 Fix it by removing the -1.
13 Signed-off-by: Lukas Czerner <lczerner@redhat.com>
14 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 Reviewed-by: Namjae Jeon <namjae.jeon@samsung.com>
17 fs/ext4/extents.c | 2 +-
18 1 file changed, 1 insertion(+), 1 deletion(-)
20 diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
21 index 821c1d4..25ed60f 100644
22 --- a/fs/ext4/extents.c
23 +++ b/fs/ext4/extents.c
24 @@ -5422,7 +5422,7 @@ int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len)
25 ext4_discard_preallocations(inode);
27 ret = ext4_es_remove_extent(inode, punch_start,
28 - EXT_MAX_BLOCKS - punch_start - 1);
29 + EXT_MAX_BLOCKS - punch_start);
31 up_write(&EXT4_I(inode)->i_data_sem);
37 To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
38 the body of a message to majordomo@vger.kernel.org
39 More majordomo info at http://vger.kernel.org/majordomo-info.html