]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: make thaw time super block check to also verify checksum
authorQu Wenruo <wqu@suse.com>
Tue, 18 Oct 2022 01:56:38 +0000 (09:56 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 24 Oct 2022 13:28:29 +0000 (15:28 +0200)
commit0e37cba6b1b11e655d2bb006194eb21eb97ba7fd
tree422fb6b536dc882ea54c1183d86ce1d15966c91f
parent34d05df6620c7500da65e00529231d1ca587d39a
btrfs: make thaw time super block check to also verify checksum

Previous commit 78c9eb420453 ("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: 78c9eb420453 ("btrfs: check superblock to ensure the fs was not modified at thaw time")
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/disk-io.c
fs/btrfs/disk-io.h
fs/btrfs/super.c