Skip to content

Commit 28739ee

Browse files
Lukas Czernertytso
authored andcommitted
ext4: protect bb_first_free in ext4_trim_all_free() with group lock
We should protect reading bd_info->bb_first_free with the group lock because otherwise we might miss some free blocks. This is not a big deal at all, but the change to do right thing is really simple, so lets do that. Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
1 parent 7894408 commit 28739ee

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎fs/ext4/mballoc.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4825,11 +4825,11 @@ ext4_trim_all_free(struct super_block *sb, ext4_group_t group,
48254825
"information for %u", group);
48264826
return ret;
48274827
}
4828-
48294828
bitmap = e4b.bd_bitmap;
4829+
4830+
ext4_lock_group(sb, group);
48304831
start = (e4b.bd_info->bb_first_free > start) ?
48314832
e4b.bd_info->bb_first_free : start;
4832-
ext4_lock_group(sb, group);
48334833

48344834
while (start < max) {
48354835
start = mb_find_next_zero_bit(bitmap, max, start);

0 commit comments

Comments
 (0)