summaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2023-04-12 04:00:06 +0200
committerDarrick J. Wong <djwong@kernel.org>2023-04-12 04:00:06 +0200
commite774b2ea0bb130d00e3cb1c29cd91028d0c0c83d (patch)
tree0a15b8b024b0056140fdc0788a13548cdea4c9aa /fs/xfs/libxfs
parentxfs: hoist rmap record flag checks from scrub (diff)
downloadlinux-e774b2ea0bb130d00e3cb1c29cd91028d0c0c83d.tar.xz
linux-e774b2ea0bb130d00e3cb1c29cd91028d0c0c83d.zip
xfs: hoist rmap record flag checks from scrub
Move the rmap record flag checks from xchk_rmapbt_rec into xfs_rmap_check_irec so that they are applied everywhere. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/libxfs')
-rw-r--r--fs/xfs/libxfs/xfs_rmap.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_rmap.c b/fs/xfs/libxfs/xfs_rmap.c
index e66ecd794a84..da008d317f83 100644
--- a/fs/xfs/libxfs/xfs_rmap.c
+++ b/fs/xfs/libxfs/xfs_rmap.c
@@ -254,6 +254,11 @@ xfs_rmap_check_irec(
if (!is_inode && (is_bmbt || is_unwritten || is_attr))
return __this_address;
+ /* Check for a valid fork offset, if applicable. */
+ if (is_inode && !is_bmbt &&
+ !xfs_verify_fileext(mp, irec->rm_offset, irec->rm_blockcount))
+ return __this_address;
+
return NULL;
}