xfs: make sure aglen never goes negative in xfs_refcount_adjust_extents
authorDarrick J. Wong <djwong@kernel.org>
Wed, 26 Oct 2022 01:18:21 +0000 (18:18 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Mon, 31 Oct 2022 15:58:20 +0000 (08:58 -0700)
commitf850995f60e49818093ef5e477cdb0ff2c11a0a4
treec2c25e75c9fded537a94a85dfbc973a871cfa998
parent950f0d50ee7138d7e631aefea8528d485426eda6
xfs: make sure aglen never goes negative in xfs_refcount_adjust_extents

Prior to calling xfs_refcount_adjust_extents, we trimmed agbno/aglen
such that the end of the range would not be in the middle of a refcount
record.  If this is no longer the case, something is seriously wrong
with the btree.  Bail out with a corruption error.

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