Skip to content

Commit ca6e909

Browse files
jankaratytso
authored andcommitted
ext4: fix trimming of a single group
When ext4_trim_fs() is called to trim a part of a single group, the logic will wrongly set last block of the interval to 'len' instead of 'first_block + len'. Thus a shorter interval is possibly trimmed. Fix it. CC: Lukas Czerner <lczerner@redhat.com> Cc: stable@kernel.org Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
1 parent 6c5a6cb commit ca6e909

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎fs/ext4/mballoc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4860,7 +4860,7 @@ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range)
48604860
if (len >= EXT4_BLOCKS_PER_GROUP(sb))
48614861
len -= (EXT4_BLOCKS_PER_GROUP(sb) - first_block);
48624862
else
4863-
last_block = len;
4863+
last_block = first_block + len;
48644864

48654865
if (e4b.bd_info->bb_free >= minlen) {
48664866
cnt = ext4_trim_all_free(sb, &e4b, first_block,

0 commit comments

Comments
 (0)