diff options
author | Darrick J. Wong <djwong@kernel.org> | 2022-10-26 14:16:36 -0700 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2022-10-31 08:58:21 -0700 |
commit | f62ac3e0ac33d366fe81e194fee81de9be2cd886 (patch) | |
tree | 24f6eb1e62e928d76786f3f9a33bd146abc0d3cc /fs/xfs/scrub/refcount.c | |
parent | 68d0f389179a52555cfd8fa3254e4adcd7576904 (diff) | |
download | linux-stable-f62ac3e0ac33d366fe81e194fee81de9be2cd886.tar.gz linux-stable-f62ac3e0ac33d366fe81e194fee81de9be2cd886.tar.bz2 linux-stable-f62ac3e0ac33d366fe81e194fee81de9be2cd886.zip |
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>
Diffstat (limited to 'fs/xfs/scrub/refcount.c')
-rw-r--r-- | fs/xfs/scrub/refcount.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/xfs/scrub/refcount.c b/fs/xfs/scrub/refcount.c index fe5ffe4f478d..a26ee0f24ef2 100644 --- a/fs/xfs/scrub/refcount.c +++ b/fs/xfs/scrub/refcount.c @@ -439,8 +439,8 @@ xchk_xref_is_cow_staging( return; } - /* CoW flag must be set, refcount must be 1. */ - if (rc.rc_domain != XFS_REFC_DOMAIN_COW || rc.rc_refcount != 1) + /* CoW lookup returned a shared extent record? */ + if (rc.rc_domain != XFS_REFC_DOMAIN_COW) xchk_btree_xref_set_corrupt(sc, sc->sa.refc_cur, 0); /* Must be at least as long as what was passed in */ |