[SRU,Bionic,1/1] UBUNTU: SAUCE: ext4: fix ext4_validate_inode_bitmap: comm stress-ng: Corrupt inode bitmap

Message ID 1531260691-10706-2-git-send-email-kamal@canonical.com
State New
Headers show
Series
  • [SRU,Bionic,1/1] UBUNTU: SAUCE: ext4: fix ext4_validate_inode_bitmap: comm stress-ng: Corrupt inode bitmap
Related show

Commit Message

Kamal Mostafa July 10, 2018, 10:11 p.m.
From: "Theodore Y. Ts'o" <tytso@mit.edu>

BugLink: http://bugs.launchpad.net/bugs/1780137

Fix regression triggered by the stress-ng[*] "chdir" test, with LKML test
patch.

Regression observed on some arm64 server platforms:

    EXT4-fs error (device sda1): ext4_validate_inode_bitmap:99: comm stress-ng: Corrupt inode bitmap

Reference: https://lkml.org/lkml/2018/7/7/2

Reported-by: dann frazier <dann.frazier@canonical.com>
Tested-by: dann frazier <dann.frazier@canonical.com>
Fixes: 044e6e3d74a3 ext4: don't update checksum of new initialized bitmaps
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/ext4/ialloc.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Colin King July 10, 2018, 10:25 p.m. | #1
On 10/07/18 23:11, Kamal Mostafa wrote:
> From: "Theodore Y. Ts'o" <tytso@mit.edu>
> 
> BugLink: http://bugs.launchpad.net/bugs/1780137
> 
> Fix regression triggered by the stress-ng[*] "chdir" test, with LKML test
> patch.
> 
> Regression observed on some arm64 server platforms:
> 
>     EXT4-fs error (device sda1): ext4_validate_inode_bitmap:99: comm stress-ng: Corrupt inode bitmap
> 
> Reference: https://lkml.org/lkml/2018/7/7/2
> 
> Reported-by: dann frazier <dann.frazier@canonical.com>
> Tested-by: dann frazier <dann.frazier@canonical.com>
> Fixes: 044e6e3d74a3 ext4: don't update checksum of new initialized bitmaps
> Signed-off-by: Kamal Mostafa <kamal@canonical.com>
> ---
>  fs/ext4/ialloc.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
> index 5559313..b5e2cc2 100644
> --- a/fs/ext4/ialloc.c
> +++ b/fs/ext4/ialloc.c
> @@ -91,6 +91,8 @@ static int ext4_validate_inode_bitmap(struct super_block *sb,
>  		return -EFSCORRUPTED;
>  
>  	ext4_lock_group(sb, block_group);
> +	if (buffer_verified(bh))
> +		goto verified;
>  	blk = ext4_inode_bitmap(sb, desc);
>  	if (!ext4_inode_bitmap_csum_verify(sb, block_group, desc, bh,
>  					   EXT4_INODES_PER_GROUP(sb) / 8)) {
> @@ -108,6 +110,7 @@ static int ext4_validate_inode_bitmap(struct super_block *sb,
>  		return -EFSBADCRC;
>  	}
>  	set_buffer_verified(bh);
> +verified:
>  	ext4_unlock_group(sb, block_group);
>  	return 0;
>  }
> 
Fixes the reported issue, can't argue with that.

Acked-by: Colin Ian King <colin.king@canonical.com>

Patch

diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 5559313..b5e2cc2 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -91,6 +91,8 @@  static int ext4_validate_inode_bitmap(struct super_block *sb,
 		return -EFSCORRUPTED;
 
 	ext4_lock_group(sb, block_group);
+	if (buffer_verified(bh))
+		goto verified;
 	blk = ext4_inode_bitmap(sb, desc);
 	if (!ext4_inode_bitmap_csum_verify(sb, block_group, desc, bh,
 					   EXT4_INODES_PER_GROUP(sb) / 8)) {
@@ -108,6 +110,7 @@  static int ext4_validate_inode_bitmap(struct super_block *sb,
 		return -EFSBADCRC;
 	}
 	set_buffer_verified(bh);
+verified:
 	ext4_unlock_group(sb, block_group);
 	return 0;
 }