xfs: allow extent free intents to be retried
authorDave Chinner <dchinner@redhat.com>
Wed, 28 Jun 2023 18:04:33 +0000 (11:04 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 29 Jun 2023 16:28:24 +0000 (09:28 -0700)
commit0853b5de42b471a92f4ff128a8757b87427d2431
tree7bd7360491b2425bfe2fdc2062157e94743b6a37
parent6a2a9d776c4ae24a797e25eed2b9f7f33f756296
xfs: allow extent free intents to be retried

Extent freeing neeeds to be able to avoid a busy extent deadlock
when the transaction itself holds the only busy extents in the
allocation group. This may occur if we have an EFI that contains
multiple extents to be freed, and the freeing the second intent
requires the space the first extent free released to expand the
AGFL. If we block on the busy extent at this point, we deadlock.

We hold a dirty transaction that contains a entire atomic extent
free operations within it, so if we can abort the extent free
operation and commit the progress that we've made, the busy extent
can be resolved by a log force. Hence we can restart the aborted
extent free with a new transaction and continue to make
progress without risking deadlocks.

To enable this, we need the EFI processing code to be able to handle
an -EAGAIN error to tell it to commit the current transaction and
retry again. This mechanism is already built into the defer ops
processing (used bythe refcount btree modification intents), so
there's relatively little handling we need to add to the EFI code to
enable this.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
fs/xfs/xfs_extfree_item.c