Message ID | 20190904042451.9314-2-david@fromorbit.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | xfs: log race fixes and cleanups | expand |
> + if (*free_bytes < need_bytes) { > + if (!woken_task) > + xlog_grant_push_ail(log, need_bytes); > return false; > + } It would be nice to have a comment here with the condensed wisdom from the commit log.
On Tue, Sep 03, 2019 at 11:07:07PM -0700, Christoph Hellwig wrote: > > + if (*free_bytes < need_bytes) { > > + if (!woken_task) > > + xlog_grant_push_ail(log, need_bytes); > > return false; > > + } > > It would be nice to have a comment here with the condensed wisdom from > the commit log. Fixed.
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index b159a9e9fef0..941f10ff99d9 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c @@ -214,15 +214,20 @@ xlog_grant_head_wake( { struct xlog_ticket *tic; int need_bytes; + bool woken_task = false; list_for_each_entry(tic, &head->waiters, t_queue) { need_bytes = xlog_ticket_reservation(log, head, tic); - if (*free_bytes < need_bytes) + if (*free_bytes < need_bytes) { + if (!woken_task) + xlog_grant_push_ail(log, need_bytes); return false; + } *free_bytes -= need_bytes; trace_xfs_log_grant_wake_up(log, tic); wake_up_process(tic->t_task); + woken_task = true; } return true;