On 10.05.19 г. 14:15 ч., Johannes Thumshirn wrote: > Check for supported superblock checksum type before doing the actual > checksum validation of the superblock read from disk. This is rather terse, how does it improve the code and what was the current status quo (e.g before this patch). > > Signed-off-by: Johannes Thumshirn <[email protected]> > --- > fs/btrfs/disk-io.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c > index ab13282d91d2..74937effaed4 100644 > --- a/fs/btrfs/disk-io.c > +++ b/fs/btrfs/disk-io.c > @@ -2822,6 +2822,14 @@ int open_ctree(struct super_block *sb, > goto fail_alloc; > } > > + if (!btrfs_supported_super_csum((struct btrfs_super_block *) > + bh->b_data)) { > + btrfs_err(fs_info, "unsupported checksum algorithm"); > + 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). >
- Re: [PATCH 11/17] btrfs: Simplify btrfs_check_supe... Nikolay Borisov
- [PATCH 15/17] btrfs: remove assumption about csum type ... Johannes Thumshirn
- [PATCH 12/17] btrfs: add boilerplate code for directly ... Johannes Thumshirn
- Re: [PATCH 12/17] btrfs: add boilerplate code for ... Nikolay Borisov
- [PATCH 01/17] btrfs: use btrfs_csum_data() instead of d... Johannes Thumshirn
- Re: [PATCH 01/17] btrfs: use btrfs_csum_data() ins... Nikolay Borisov
- [PATCH 09/17] btrfs: add common checksum type validatio... Johannes Thumshirn
- Re: [PATCH 09/17] btrfs: add common checksum type ... Nikolay Borisov
- [PATCH 10/17] btrfs: check for supported superblock che... Johannes Thumshirn
- Re: [PATCH 10/17] btrfs: check for supported super... Nikolay Borisov
- [PATCH 03/17] btrfs: use btrfs_crc32c() instead of btrf... Johannes Thumshirn
- Re: [PATCH 03/17] btrfs: use btrfs_crc32c() instea... Nikolay Borisov
- [PATCH 07/17] btrfs: use btrfs_crc32c{,_final}() in for... Johannes Thumshirn
- Re: [PATCH 07/17] btrfs: use btrfs_crc32c{,_final}... Nikolay Borisov
- [PATCH 04/17] btrfs: use btrfs_crc32c() instead of btrf... Johannes Thumshirn
- Re: [PATCH 04/17] btrfs: use btrfs_crc32c() instea... Chris Mason
- Re: [PATCH 04/17] btrfs: use btrfs_crc32c() in... Johannes Thumshirn
- [PATCH 16/17] btrfs: remove assumption about csum type ... Johannes Thumshirn
- Re: [PATCH 00/17] Add support for SHA-256 checksums David Sterba
