Commit 41e5b7ed authored by Lukas Czerner's avatar Lukas Czerner Committed by Theodore Ts'o

ext4: verify block bitmap even after fresh initialization

If we want to rely on the buffer_verified() flag of the block bitmap
buffer, we have to set it consistently. However currently if we're
initializing uninitialized block bitmap in
ext4_read_block_bitmap_nowait() we're not going to set buffer verified
at all.

We can do this by simply setting the flag on the buffer, but I think
it's actually better to run ext4_validate_block_bitmap() to make sure
that what we did in the ext4_init_block_bitmap() is right.

So run ext4_validate_block_bitmap() even after the block bitmap
initialization. Also bail out early from ext4_validate_block_bitmap() if
we see corrupt bitmap, since we already know it's corrupt and we do not
need to verify that.
Signed-off-by: default avatarLukas Czerner <lczerner@redhat.com>
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent 6ccaf3e2
...@@ -369,7 +369,7 @@ static void ext4_validate_block_bitmap(struct super_block *sb, ...@@ -369,7 +369,7 @@ static void ext4_validate_block_bitmap(struct super_block *sb,
struct ext4_group_info *grp = ext4_get_group_info(sb, block_group); struct ext4_group_info *grp = ext4_get_group_info(sb, block_group);
struct ext4_sb_info *sbi = EXT4_SB(sb); struct ext4_sb_info *sbi = EXT4_SB(sb);
if (buffer_verified(bh)) if (buffer_verified(bh) || EXT4_MB_GRP_BBITMAP_CORRUPT(grp))
return; return;
ext4_lock_group(sb, block_group); ext4_lock_group(sb, block_group);
...@@ -446,7 +446,7 @@ ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group) ...@@ -446,7 +446,7 @@ ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group)
unlock_buffer(bh); unlock_buffer(bh);
if (err) if (err)
ext4_error(sb, "Checksum bad for grp %u", block_group); ext4_error(sb, "Checksum bad for grp %u", block_group);
return bh; goto verify;
} }
ext4_unlock_group(sb, block_group); ext4_unlock_group(sb, block_group);
if (buffer_uptodate(bh)) { if (buffer_uptodate(bh)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment