Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Lukas Czerner and committed by
Theodore Ts'o
28739eea 78944086

+2 -2
+2 -2
fs/ext4/mballoc.c
··· 4825 4825 "information for %u", group); 4826 4826 return ret; 4827 4827 } 4828 - 4829 4828 bitmap = e4b.bd_bitmap; 4829 + 4830 + ext4_lock_group(sb, group); 4830 4831 start = (e4b.bd_info->bb_first_free > start) ? 4831 4832 e4b.bd_info->bb_first_free : start; 4832 - ext4_lock_group(sb, group); 4833 4833 4834 4834 while (start < max) { 4835 4835 start = mb_find_next_zero_bit(bitmap, max, start);