1 ext4: verify block bitmap even after fresh initialization
3 From: Lukas Czerner <lczerner@redhat.com>
5 If we want to rely on the buffer_verified() flag of the block bitmap
6 buffer, we have to set it consistently. However currently if we're
7 initializing uninitialized block bitmap in
8 ext4_read_block_bitmap_nowait() we're not going to set buffer verified
11 We can do this by simply setting the flag on the buffer, but I think
12 it's actually better to run ext4_validate_block_bitmap() to make sure
13 that what we did in the ext4_init_block_bitmap() is right.
15 So run ext4_validate_block_bitmap() even after the block bitmap
16 initialization. Also bail out early from ext4_validate_block_bitmap() if
17 we see corrupt bitmap, since we already know it's corrupt and we do not
20 Signed-off-by: Lukas Czerner <lczerner@redhat.com>
21 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
26 fs/ext4/balloc.c | 4 ++--
27 1 file changed, 2 insertions(+), 2 deletions(-)
29 diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
30 index 955bf49..cd6ea29 100644
31 --- a/fs/ext4/balloc.c
32 +++ b/fs/ext4/balloc.c
33 @@ -369,7 +369,7 @@ static void ext4_validate_block_bitmap(struct super_block *sb,
34 struct ext4_group_info *grp = ext4_get_group_info(sb, block_group);
35 struct ext4_sb_info *sbi = EXT4_SB(sb);
37 - if (buffer_verified(bh))
38 + if (buffer_verified(bh) || EXT4_MB_GRP_BBITMAP_CORRUPT(grp))
41 ext4_lock_group(sb, block_group);
42 @@ -446,7 +446,7 @@ ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group)
45 ext4_error(sb, "Checksum bad for grp %u", block_group);
49 ext4_unlock_group(sb, block_group);
50 if (buffer_uptodate(bh)) {
55 To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
56 the body of a message to majordomo@vger.kernel.org
57 More majordomo info at http://vger.kernel.org/majordomo-info.html