提交 8dc3f22c 编写于 作者: J Johannes Thumshirn 提交者: David Sterba

btrfs: check for supported superblock checksum type before checksum validation

Now that we have factorerd out the superblock checksum type validation,
we can check for supported superblock checksum types before doing the
actual validation of the superblock read from disk.

This leads the path to further simplifications of
btrfs_check_super_csum() later on.
Reviewed-by: NNikolay Borisov <nborisov@suse.com>
Signed-off-by: NJohannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: NDavid Sterba <dsterba@suse.com>
[ add comment ]
Signed-off-by: NDavid Sterba <dsterba@suse.com>
上级 e7e16f48
......@@ -2816,6 +2816,20 @@ int open_ctree(struct super_block *sb,
goto fail_alloc;
}
/*
* Verify the type first, if that or the the checksum value are
* corrupted, we'll find out
*/
if (!btrfs_supported_super_csum(btrfs_super_csum_type(
(struct btrfs_super_block *) bh->b_data))) {
btrfs_err(fs_info, "unsupported checksum algorithm: %u",
btrfs_super_csum_type((struct btrfs_super_block *)
bh->b_data));
err = -EINVAL;
brelse(bh);
goto fail_alloc;
}
/*
* We want to check superblock checksum, the type is stored inside.
* Pass the whole disk block of size BTRFS_SUPER_INFO_SIZE (4k).
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册