xfs: distinguish between bnobt and cntbt magic values
authorBrian Foster <bfoster@redhat.com>
Thu, 7 Feb 2019 18:45:47 +0000 (10:45 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Tue, 12 Feb 2019 00:07:01 +0000 (16:07 -0800)
commitb8f89801664f8413a88cf2c7539d1aeae07dd3c5
treea109a552d7bd5e90572350a43d6853e8db9a817e
parent27df4f5045fc68766980c4dfba5ffc9ad1f71ebb
xfs: distinguish between bnobt and cntbt magic values

The allocation btree verifiers share code that is unable to detect
cross-tree magic value corruptions such as a bnobt block with a
cntbt magic value. Populate the b_ops->magic field of the associated
verifier structures such that the structure verifier can check the
magic value against the expected value based on tree type.

The btree level check requires knowledge of the tree type to
determine the appropriate maximum value. This was previously part of
the hardcoded magic value checks. With that code removed, peek at
the first magic value in the verifier to determine the expected tree
type of the current block.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/libxfs/xfs_alloc_btree.c