• Qu Wenruo's avatar
    btrfs: make thaw time super block check to also verify checksum · 3d17adea
    Qu Wenruo authored
    Previous commit a05d3c91 ("btrfs: check superblock to ensure the fs
    was not modified at thaw time") only checks the content of the super
    block, but it doesn't really check if the on-disk super block has a
    matching checksum.
    
    This patch will add the checksum verification to thaw time superblock
    verification.
    
    This involves the following extra changes:
    
    - Export btrfs_check_super_csum()
      As we need to call it in super.c.
    
    - Change the argument list of btrfs_check_super_csum()
      Instead of passing a char *, directly pass struct btrfs_super_block *
      pointer.
    
    - Verify that our checksum type didn't change before checking the
      checksum value, like it's done at mount time
    
    Fixes: a05d3c91 ("btrfs: check superblock to ensure the fs was not modified at thaw time")
    Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
    Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    3d17adea
super.c 76.6 KB