• Dave Chinner's avatar
    xfs: allow extent free intents to be retried · 0853b5de
    Dave Chinner authored
    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: default avatarDave Chinner <dchinner@redhat.com>
    Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
    Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
    Reviewed-by: default avatarChandan Babu R <chandan.babu@oracle.com>
    0853b5de
xfs_extfree_item.c 24.3 KB