diff options
author | Brian Foster <[email protected]> | 2019-02-07 10:45:48 -0800 |
---|---|---|
committer | Darrick J. Wong <[email protected]> | 2019-02-11 16:07:01 -0800 |
commit | 39708c20ab51337c3eb282a824eb0aaff7ebe2e1 (patch) | |
tree | ad3e741a8fbafdfa13531f9efdf91557daada42d /fs/xfs/libxfs/xfs_attr_leaf.c | |
parent | 09f420197d7ced360b4809606efd7a65f842c2c0 (diff) |
xfs: miscellaneous verifier magic value fixups
Most buffer verifiers have hardcoded magic value checks
conditionalized on the version of the filesystem. The magic value
field of the verifier structure facilitates abstraction of some of
this code. Populate the ->magic field of various verifiers to take
advantage of this abstraction. No functional changes.
Signed-off-by: Brian Foster <[email protected]>
Reviewed-by: Darrick J. Wong <[email protected]>
Signed-off-by: Darrick J. Wong <[email protected]>
Diffstat (limited to 'fs/xfs/libxfs/xfs_attr_leaf.c')
-rw-r--r-- | fs/xfs/libxfs/xfs_attr_leaf.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c index e60eba7f129c..f164f296f1b8 100644 --- a/fs/xfs/libxfs/xfs_attr_leaf.c +++ b/fs/xfs/libxfs/xfs_attr_leaf.c @@ -248,21 +248,18 @@ xfs_attr3_leaf_verify( xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, leaf); + if (!xfs_verify_magic(bp, leaf->hdr.info.magic)) + return __this_address; + if (xfs_sb_version_hascrc(&mp->m_sb)) { struct xfs_da3_node_hdr *hdr3 = bp->b_addr; - if (hdr3->info.hdr.magic != cpu_to_be16(XFS_ATTR3_LEAF_MAGIC)) - return __this_address; - if (!uuid_equal(&hdr3->info.uuid, &mp->m_sb.sb_meta_uuid)) return __this_address; if (be64_to_cpu(hdr3->info.blkno) != bp->b_bn) return __this_address; if (!xfs_log_check_lsn(mp, be64_to_cpu(hdr3->info.lsn))) return __this_address; - } else { - if (leaf->hdr.info.magic != cpu_to_be16(XFS_ATTR_LEAF_MAGIC)) - return __this_address; } /* * In recovery there is a transient state where count == 0 is valid @@ -369,6 +366,8 @@ xfs_attr3_leaf_read_verify( const struct xfs_buf_ops xfs_attr3_leaf_buf_ops = { .name = "xfs_attr3_leaf", + .magic = { cpu_to_be16(XFS_ATTR_LEAF_MAGIC), + cpu_to_be16(XFS_ATTR3_LEAF_MAGIC) }, .verify_read = xfs_attr3_leaf_read_verify, .verify_write = xfs_attr3_leaf_write_verify, .verify_struct = xfs_attr3_leaf_verify, |