xfs: check record domain when accessing refcount records
authorDarrick J. Wong <djwong@kernel.org>
Wed, 26 Oct 2022 21:16:36 +0000 (14:16 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Mon, 31 Oct 2022 15:58:21 +0000 (08:58 -0700)
commitf62ac3e0ac33d366fe81e194fee81de9be2cd886
tree24f6eb1e62e928d76786f3f9a33bd146abc0d3cc
parent68d0f389179a52555cfd8fa3254e4adcd7576904
xfs: check record domain when accessing refcount records

Now that we've separated the startblock and CoW/shared extent domain in
the incore refcount record structure, check the domain whenever we
retrieve a record to ensure that it's still in the domain that we want.
Depending on the circumstances, a change in domain either means we're
done processing or that we've found a corruption and need to fail out.

The refcount check in xchk_xref_is_cow_staging is redundant since
_get_rec has done that for a long time now, so we can get rid of it.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
fs/xfs/libxfs/xfs_refcount.c
fs/xfs/scrub/refcount.c