]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: check deferred refcount op continuation parameters
authorDarrick J. Wong <djwong@kernel.org>
Mon, 10 Oct 2022 18:33:47 +0000 (11:33 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Mon, 31 Oct 2022 15:58:20 +0000 (08:58 -0700)
commit57c106df2c295bccb66d3f61f82de3eb74b873e0
tree235d67da81033f290b339e8931b388c6e7a573cc
parent094e44dbeca8a0ad244cc2964bb4ee82e67e8c62
xfs: check deferred refcount op continuation parameters

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@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
fs/xfs/libxfs/xfs_refcount.c