aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/mballoc.c
diff options
context:
space:
mode:
authorLukas Czerner <lczerner@redhat.com>2011-05-24 18:28:07 -0400
committerTheodore Ts'o <tytso@mit.edu>2011-05-24 18:28:07 -0400
commit28739eea9cd42598b632972f5cc64a458c5d40b3 (patch)
tree10d4db959544884e6612ea329920a2cf73a6f0b6 /fs/ext4/mballoc.c
parent78944086663e6c1b03f3d60bf7610128149be5fc (diff)
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>
Diffstat (limited to 'fs/ext4/mballoc.c')
-rw-r--r--fs/ext4/mballoc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 38a11bf7932..396b01f5c4f 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -4825,11 +4825,11 @@ ext4_trim_all_free(struct super_block *sb, ext4_group_t group,
4825 "information for %u", group); 4825 "information for %u", group);
4826 return ret; 4826 return ret;
4827 } 4827 }
4828
4829 bitmap = e4b.bd_bitmap; 4828 bitmap = e4b.bd_bitmap;
4829
4830 ext4_lock_group(sb, group);
4830 start = (e4b.bd_info->bb_first_free > start) ? 4831 start = (e4b.bd_info->bb_first_free > start) ?
4831 e4b.bd_info->bb_first_free : start; 4832 e4b.bd_info->bb_first_free : start;
4832 ext4_lock_group(sb, group);
4833 4833
4834 while (start < max) { 4834 while (start < max) {
4835 start = mb_find_next_zero_bit(bitmap, max, start); 4835 start = mb_find_next_zero_bit(bitmap, max, start);