From 95a8c9187f6418d578062927a17ecb9359246274 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Mon, 6 May 2019 18:00:20 -0400 Subject: [PATCH] xfs: scrub should flag dir/attr offsets that aren't mappable with xfs_dablk_t Source kernel commit: f8c1d7023e252df853efbb3566c6d47b148609fe Teach scrub to flag extent maps that exceed the range that can be mapped with a xfs_dablk_t. Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster Signed-off-by: Eric Sandeen --- libxfs/xfs_types.c | 11 +++++++++++ libxfs/xfs_types.h | 1 + 2 files changed, 12 insertions(+) diff --git a/libxfs/xfs_types.c b/libxfs/xfs_types.c index 852ca21c5..01e073e67 100644 --- a/libxfs/xfs_types.c +++ b/libxfs/xfs_types.c @@ -204,3 +204,14 @@ xfs_verify_icount( xfs_icount_range(mp, &min, &max); return icount >= min && icount <= max; } + +/* Sanity-checking of dir/attr block offsets. */ +bool +xfs_verify_dablk( + struct xfs_mount *mp, + xfs_fileoff_t dabno) +{ + xfs_dablk_t max_dablk = -1U; + + return dabno <= max_dablk; +} diff --git a/libxfs/xfs_types.h b/libxfs/xfs_types.h index 8f02855a0..704b4f308 100644 --- a/libxfs/xfs_types.h +++ b/libxfs/xfs_types.h @@ -188,5 +188,6 @@ bool xfs_internal_inum(struct xfs_mount *mp, xfs_ino_t ino); bool xfs_verify_dir_ino(struct xfs_mount *mp, xfs_ino_t ino); bool xfs_verify_rtbno(struct xfs_mount *mp, xfs_rtblock_t rtbno); bool xfs_verify_icount(struct xfs_mount *mp, unsigned long long icount); +bool xfs_verify_dablk(struct xfs_mount *mp, xfs_fileoff_t off); #endif /* __XFS_TYPES_H__ */ -- 2.47.2