Patchwork [028/270] ext4: remove erroneous ext4_superblock_csum_set() in update_backups()

login
register
mail settings
Submitter Herton Ronaldo Krzesinski
Date Nov. 26, 2012, 4:55 p.m.
Message ID <1353949160-26803-29-git-send-email-herton.krzesinski@canonical.com>
Download mbox | patch
Permalink /patch/201761/
State New
Headers show

Comments

Herton Ronaldo Krzesinski - Nov. 26, 2012, 4:55 p.m.
3.5.7u1 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Tao Ma <boyu.mt@taobao.com>

commit bef53b01faeb791e27605cba1a71ba21364cb23e upstream.

The update_backups() function is used to backup all the metadata
blocks, so we should not take it for granted that 'data' is pointed to
a super block and use ext4_superblock_csum_set to calculate the
checksum there.  In case where the data is a group descriptor block,
it will corrupt the last group descriptor, and then e2fsck will
complain about it it.

As all the metadata checksums should already be OK when we do the
backup, remove the wrong ext4_superblock_csum_set and it should be
just fine.

Reported-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Tao Ma <boyu.mt@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
[ herton: adjust context ]
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 fs/ext4/resize.c |    2 --
 1 file changed, 2 deletions(-)
Ben Hutchings - Nov. 27, 2012, 2:22 a.m.
On Mon, 2012-11-26 at 14:55 -0200, Herton Ronaldo Krzesinski wrote:
> 3.5.7u1 -stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Tao Ma <boyu.mt@taobao.com>
> 
> commit bef53b01faeb791e27605cba1a71ba21364cb23e upstream.
> 
> The update_backups() function is used to backup all the metadata
> blocks, so we should not take it for granted that 'data' is pointed to
> a super block and use ext4_superblock_csum_set to calculate the
> checksum there.  In case where the data is a group descriptor block,
> it will corrupt the last group descriptor, and then e2fsck will
> complain about it it.
> 
> As all the metadata checksums should already be OK when we do the
> backup, remove the wrong ext4_superblock_csum_set and it should be
> just fine.
> 
> Reported-by: "Theodore Ts'o" <tytso@mit.edu>
> Signed-off-by: Tao Ma <boyu.mt@taobao.com>
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
> [ herton: adjust context ]
> Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>

This should also be applicable to 3.6.

Ben.

> ---
>  fs/ext4/resize.c |    2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
> index b0bdd10..dc1affc 100644
> --- a/fs/ext4/resize.c
> +++ b/fs/ext4/resize.c
> @@ -979,8 +979,6 @@ static void update_backups(struct super_block *sb,
>  		goto exit_err;
>  	}
>  
> -	ext4_superblock_csum_set(sb, (struct ext4_super_block *)data);
> -
>  	while ((group = ext4_list_backups(sb, &three, &five, &seven)) < last) {
>  		struct buffer_head *bh;
>
Greg KH - Nov. 30, 2012, 1:33 a.m.
On Tue, Nov 27, 2012 at 02:22:19AM +0000, Ben Hutchings wrote:
> On Mon, 2012-11-26 at 14:55 -0200, Herton Ronaldo Krzesinski wrote:
> > 3.5.7u1 -stable review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Tao Ma <boyu.mt@taobao.com>
> > 
> > commit bef53b01faeb791e27605cba1a71ba21364cb23e upstream.
> > 
> > The update_backups() function is used to backup all the metadata
> > blocks, so we should not take it for granted that 'data' is pointed to
> > a super block and use ext4_superblock_csum_set to calculate the
> > checksum there.  In case where the data is a group descriptor block,
> > it will corrupt the last group descriptor, and then e2fsck will
> > complain about it it.
> > 
> > As all the metadata checksums should already be OK when we do the
> > backup, remove the wrong ext4_superblock_csum_set and it should be
> > just fine.
> > 
> > Reported-by: "Theodore Ts'o" <tytso@mit.edu>
> > Signed-off-by: Tao Ma <boyu.mt@taobao.com>
> > Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
> > [ herton: adjust context ]
> > Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
> 
> This should also be applicable to 3.6.

Thanks, it didn't apply there, so I didn't take it, defering to the ext4
developers, who seem to be a bit busy :)

greg k-h

Patch

diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index b0bdd10..dc1affc 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -979,8 +979,6 @@  static void update_backups(struct super_block *sb,
 		goto exit_err;
 	}
 
-	ext4_superblock_csum_set(sb, (struct ext4_super_block *)data);
-
 	while ((group = ext4_list_backups(sb, &three, &five, &seven)) < last) {
 		struct buffer_head *bh;