From: Darrick J. Wong Date: Wed, 31 May 2023 09:03:21 +0000 (+0200) Subject: xfs: hoist inode record alignment checks from scrub X-Git-Tag: v6.4.0~45 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=71ba9fccae27d8ebe3e966fa066ba0fe3c6fc7d0;p=thirdparty%2Fxfsprogs-dev.git xfs: hoist inode record alignment checks from scrub Source kernel commit: de1a9ce225e93b22d189f8ffbce20074bc803121 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 Reviewed-by: Dave Chinner Signed-off-by: Carlos Maiolino --- diff --git a/libxfs/xfs_ialloc.c b/libxfs/xfs_ialloc.c index fa5ac8180..63c5b50bf 100644 --- a/libxfs/xfs_ialloc.c +++ b/libxfs/xfs_ialloc.c @@ -98,8 +98,12 @@ xfs_inobt_check_irec( { uint64_t realfree; + /* Record has to be properly aligned within the AG. */ if (!xfs_verify_agino(cur->bc_ag.pag, irec->ir_startino)) return __this_address; + if (!xfs_verify_agino(cur->bc_ag.pag, + irec->ir_startino + XFS_INODES_PER_CHUNK - 1)) + return __this_address; if (irec->ir_count < XFS_INODES_PER_HOLEMASK_BIT || irec->ir_count > XFS_INODES_PER_CHUNK) return __this_address;