On Tue, Sep 26, 2023 at 04:31:22PM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong <djwong@xxxxxxxxxx> > > 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: Darrick J. Wong <djwong@xxxxxxxxxx> > --- > fs/xfs/libxfs/xfs_defer.c | 48 ++++++++++++++++++++++++++++++++++----------- > 1 file changed, 36 insertions(+), 12 deletions(-) Looks fine. Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx> -- Dave Chinner david@xxxxxxxxxxxxx