]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: Enhance super validation check
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Tue, 15 Dec 2015 01:14:36 +0000 (09:14 +0800)
committerChris Mason <clm@fb.com>
Wed, 20 Jan 2016 02:21:41 +0000 (18:21 -0800)
commit74658dd15a5579f4c3ca90a36ecaeca2d9ac81d3
tree8930cb9cd248db15d0443bc93e046be23633921c
parent5cc116856d3a1e2e2e0ae41a9953768712957fcc
btrfs: Enhance super validation check

Enhance btrfs_check_super_valid() function by the following points:
1) Restrict sector/node size check
   Not the old max/min valid check, but also check if it's a power of 2.
   So some bogus number like 12K node size won't pass now.

2) Super flag check
   For now, there is still some inconsistency between kernel and
   btrfs-progs super flags.
   And considering btrfs-progs may add new flags for super block, this
   check will only output warning.

3) Better root alignment check
   Now root bytenr is checked against sector size.

4) Move some check into btrfs_check_super_valid().
   Like node size vs leaf size check, and PAGESIZE vs sectorsize check.
   And magic number check.

Reported-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/disk-io.c