Skip to content

Commit de1a9ce

Browse files
author
Darrick J. Wong
committed
xfs: hoist inode record alignment checks from scrub
Move the inobt record alignment checks from xchk_iallocbt_rec into xfs_inobt_check_irec so that they are applied everywhere. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Dave Chinner <dchinner@redhat.com>
1 parent e774b2e commit de1a9ce

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

fs/xfs/libxfs/xfs_ialloc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,12 @@ xfs_inobt_check_irec(
103103
{
104104
uint64_t realfree;
105105

106+
/* Record has to be properly aligned within the AG. */
106107
if (!xfs_verify_agino(cur->bc_ag.pag, irec->ir_startino))
107108
return __this_address;
109+
if (!xfs_verify_agino(cur->bc_ag.pag,
110+
irec->ir_startino + XFS_INODES_PER_CHUNK - 1))
111+
return __this_address;
108112
if (irec->ir_count < XFS_INODES_PER_HOLEMASK_BIT ||
109113
irec->ir_count > XFS_INODES_PER_CHUNK)
110114
return __this_address;

fs/xfs/scrub/ialloc.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,6 @@ xchk_iallocbt_rec(
413413
const union xfs_btree_rec *rec)
414414
{
415415
struct xfs_mount *mp = bs->cur->bc_mp;
416-
struct xfs_perag *pag = bs->cur->bc_ag.pag;
417416
struct xchk_iallocbt *iabt = bs->private;
418417
struct xfs_inobt_rec_incore irec;
419418
uint64_t holes;
@@ -431,11 +430,6 @@ xchk_iallocbt_rec(
431430
}
432431

433432
agino = irec.ir_startino;
434-
/* Record has to be properly aligned within the AG. */
435-
if (!xfs_verify_agino(pag, agino + XFS_INODES_PER_CHUNK - 1)) {
436-
xchk_btree_set_corrupt(bs->sc, bs->cur, 0);
437-
goto out;
438-
}
439433

440434
xchk_iallocbt_rec_alignment(bs, &irec);
441435
if (bs->sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)

0 commit comments

Comments
 (0)