• Darrick J. Wong's avatar
    xfs: don't append work items to logged xfs_defer_pending objects · 6b126139
    Darrick J. Wong authored
    When someone tries to add a deferred work item to xfs_defer_add, it will
    try to attach the work item to the most recently added xfs_defer_pending
    object attached to the transaction.  However, it doesn't check if the
    pending object has a log intent item attached to it.  This is incorrect
    behavior because we cannot add more work to an object that has already
    been committed to the ondisk log.
    
    Therefore, change the behavior not to append to pending items with a non
    null dfp_intent.  In practice this has not been an issue because the
    only way xfs_defer_add gets called after log intent items have been
    committed is from the defer ops ->finish_item functions themselves, and
    the @dop_pending isolation in xfs_defer_finish_noroll protects the
    pending items that have already been logged.
    
    However, the next patch will add the ability to pause a deferred extent
    free object during online btree rebuilding, and any new extfree work
    items need to have their own pending event.
    
    While we're at it, hoist the predicate to its own static inline function
    for readability.
    Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
    Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    6b126139
xfs_defer.c 31.2 KB