aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs/xfs_attr_leaf.c
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2019-02-07 13:45:48 -0500
committerDarrick J. Wong <darrick.wong@oracle.com>2019-02-11 19:07:01 -0500
commit39708c20ab51337c3eb282a824eb0aaff7ebe2e1 (patch)
treead3e741a8fbafdfa13531f9efdf91557daada42d /fs/xfs/libxfs/xfs_attr_leaf.c
parent09f420197d7ced360b4809606efd7a65f842c2c0 (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 <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/libxfs/xfs_attr_leaf.c')
-rw-r--r--fs/xfs/libxfs/xfs_attr_leaf.c11
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(
248 248
249 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, leaf); 249 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, leaf);
250 250
251 if (!xfs_verify_magic(bp, leaf->hdr.info.magic))
252 return __this_address;
253
251 if (xfs_sb_version_hascrc(&mp->m_sb)) { 254 if (xfs_sb_version_hascrc(&mp->m_sb)) {
252 struct xfs_da3_node_hdr *hdr3 = bp->b_addr; 255 struct xfs_da3_node_hdr *hdr3 = bp->b_addr;
253 256
254 if (hdr3->info.hdr.magic != cpu_to_be16(XFS_ATTR3_LEAF_MAGIC))
255 return __this_address;
256
257 if (!uuid_equal(&hdr3->info.uuid, &mp->m_sb.sb_meta_uuid)) 257 if (!uuid_equal(&hdr3->info.uuid, &mp->m_sb.sb_meta_uuid))
258 return __this_address; 258 return __this_address;
259 if (be64_to_cpu(hdr3->info.blkno) != bp->b_bn) 259 if (be64_to_cpu(hdr3->info.blkno) != bp->b_bn)
260 return __this_address; 260 return __this_address;
261 if (!xfs_log_check_lsn(mp, be64_to_cpu(hdr3->info.lsn))) 261 if (!xfs_log_check_lsn(mp, be64_to_cpu(hdr3->info.lsn)))
262 return __this_address; 262 return __this_address;
263 } else {
264 if (leaf->hdr.info.magic != cpu_to_be16(XFS_ATTR_LEAF_MAGIC))
265 return __this_address;
266 } 263 }
267 /* 264 /*
268 * In recovery there is a transient state where count == 0 is valid 265 * In recovery there is a transient state where count == 0 is valid
@@ -369,6 +366,8 @@ xfs_attr3_leaf_read_verify(
369 366
370const struct xfs_buf_ops xfs_attr3_leaf_buf_ops = { 367const struct xfs_buf_ops xfs_attr3_leaf_buf_ops = {
371 .name = "xfs_attr3_leaf", 368 .name = "xfs_attr3_leaf",
369 .magic = { cpu_to_be16(XFS_ATTR_LEAF_MAGIC),
370 cpu_to_be16(XFS_ATTR3_LEAF_MAGIC) },
372 .verify_read = xfs_attr3_leaf_read_verify, 371 .verify_read = xfs_attr3_leaf_read_verify,
373 .verify_write = xfs_attr3_leaf_write_verify, 372 .verify_write = xfs_attr3_leaf_write_verify,
374 .verify_struct = xfs_attr3_leaf_verify, 373 .verify_struct = xfs_attr3_leaf_verify,