Commit 1032988c authored by Theodore Ts'o's avatar Theodore Ts'o

ext4: fix block validity checks so they work correctly with meta_bg

The block validity checks used by ext4_data_block_valid() wasn't
correctly written to check file systems with the meta_bg feature.  Fix
this.
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
Cc: stable@kernel.org
parent 8dadb198
...@@ -160,7 +160,7 @@ int ext4_setup_system_zone(struct super_block *sb) ...@@ -160,7 +160,7 @@ int ext4_setup_system_zone(struct super_block *sb)
if (ext4_bg_has_super(sb, i) && if (ext4_bg_has_super(sb, i) &&
((i < 5) || ((i % flex_size) == 0))) ((i < 5) || ((i % flex_size) == 0)))
add_system_zone(sbi, ext4_group_first_block_no(sb, i), add_system_zone(sbi, ext4_group_first_block_no(sb, i),
sbi->s_gdb_count + 1); ext4_bg_num_gdb(sb, i) + 1);
gdp = ext4_get_group_desc(sb, i, NULL); gdp = ext4_get_group_desc(sb, i, NULL);
ret = add_system_zone(sbi, ext4_block_bitmap(sb, gdp), 1); ret = add_system_zone(sbi, ext4_block_bitmap(sb, gdp), 1);
if (ret) if (ret)
......
...@@ -4884,10 +4884,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) ...@@ -4884,10 +4884,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
ret = 0; ret = 0;
if (ei->i_file_acl && if (ei->i_file_acl &&
((ei->i_file_acl < !ext4_data_block_valid(EXT4_SB(sb), ei->i_file_acl, 1)) {
(le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block) +
EXT4_SB(sb)->s_gdb_count)) ||
(ei->i_file_acl >= ext4_blocks_count(EXT4_SB(sb)->s_es)))) {
ext4_error(sb, __func__, ext4_error(sb, __func__,
"bad extended attribute block %llu in inode #%lu", "bad extended attribute block %llu in inode #%lu",
ei->i_file_acl, inode->i_ino); ei->i_file_acl, inode->i_ino);
......
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