On Sun, Oct 30, 2022 at 04:41:38PM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong <djwong@xxxxxxxxxx> > > If we're in the middle of a deferred refcount operation and decide to > roll the transaction to avoid overflowing the transaction space, we need > to check the new agbno/aglen parameters that we're about to record in > the new intent. Specifically, we need to check that the new extent is > completely within the filesystem, and that continuation does not put us > into a different AG. > > If the keys of a node block are wrong, the lookup to resume an > xfs_refcount_adjust_extents operation can put us into the wrong record > block. If this happens, we might not find that we run out of aglen at > an exact record boundary, which will cause the loop control to do the > wrong thing. > > The previous patch should take care of that problem, but let's add this > extra sanity check to stop corruption problems sooner than later. > > Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> > --- > fs/xfs/libxfs/xfs_refcount.c | 38 ++++++++++++++++++++++++++++++++++++-- > 1 file changed, 36 insertions(+), 2 deletions(-) LGTM. Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx> -- Dave Chinner david@xxxxxxxxxxxxx