On Fri, Nov 04, 2022 at 01:17:35PM +0100, Bastian Blank wrote:
> Package: e2fsprogs
> Version: 1.46.6~rc1-1+b1
> Severity: important
> 
> While doing an online resize on lnux 6.0.5, the kernel considers the
> filesystem broken:
> 
> | [   56.958856] EXT4-fs (sda1): resizing filesystem from 491515 to 4161531 
> blocks
> | [   57.290138] EXT4-fs (sda1): resized filesystem to 4161531
> | [   57.332382] EXT4-fs (sda1): Invalid checksum for backup superblock 32768
> ...
> 
> Currently I would assume this is a bug in the kernel, do you know more?

Yes, this is a kernel bug.  It's fixed in upstream commit 9a8c5b0d0615
("ext4: update the backup superblock's at the end of the online
resize"), which landed is in v6.1-rc4 and which is tagged for
backporting to LTS.

Apologies for this not getting noticed in my pre-release testing.  I'm
working to improve the testing so this would have gotten caught
earlier.

                                        - Ted

commit 9a8c5b0d061554fedd7dbe894e63aa34d0bac7c4
Author: Theodore Ts'o <ty...@mit.edu>
Date:   Thu Oct 27 16:04:36 2022 -0400

    ext4: update the backup superblock's at the end of the online resize
    
    When expanding a file system using online resize, various fields in
    the superblock (e.g., s_blocks_count, s_inodes_count, etc.) change.
    To update the backup superblocks, the online resize uses the function
    update_backups() in fs/ext4/resize.c.  This function was not updating
    the checksum field in the backup superblocks.  This wasn't a big deal
    previously, because e2fsck didn't care about the checksum field in the
    backup superblock.  (And indeed, update_backups() goes all the way
    back to the ext3 days, well before we had support for metadata
    checksums.)
    
    However, there is an alternate, more general way of updating
    superblock fields, ext4_update_primary_sb() in fs/ext4/ioctl.c.  This
    function does check the checksum of the backup superblock, and if it
    doesn't match will mark the file system as corrupted.  That was
    clearly not the intent, so avoid to aborting the resize when a bad
    superblock is found.
    
    In addition, teach update_backups() to properly update the checksum in
    the backup superblocks.  We will eventually want to unify
    updapte_backups() with the infrasture in ext4_update_primary_sb(), but
    that's for another day.
    
    Note: The problem has been around for a while; it just didn't really
    matter until ext4_update_primary_sb() was added by commit bbc605cdb1e1
    ("ext4: implement support for get/set fs label").  And it became
    trivially easy to reproduce after commit 827891a38acc ("ext4: update
    the s_overhead_clusters in the backup sb's when resizing") in v6.0.
    
    Cc: sta...@kernel.org # 5.17+
    Fixes: bbc605cdb1e1 ("ext4: implement support for get/set fs label")
    Signed-off-by: Theodore Ts'o <ty...@mit.edu>

Reply via email to