summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2024-03-01 12:49:24 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2024-03-01 17:28:35 -0500
commit5cac21da7a1424812ccc4c3ad22aad7e0d120f8b (patch)
tree7f7c353b8c57ed9a165e76aa981053e4152644a8
parent31c9547ebba985bc8277a76cc6aca8b62748097f (diff)
bcachefs: fix lost journal buf wakeup due to improved pipelining
The journal_write_done() handler was reworked into a loop in commit 746a33c96b7a ("bcachefs: better journal pipelining"). As part of this, the journal buffer wake was factored into a post-loop branch that executes if at least one journal buffer has completed. The journal buffer processing loop iterates on the journal buffer pointer, however. This means that w refers to the last buffer processed by the loop, which may or may not be done. This also means that if multiple buffers are processed by the loop, only the last is awoken. This lost wakeup behavior has lead to stalling problems in various CI and fstests, such as generic/703. Lift the wake into the loop so each done buffer sees a wake call as it is processed. Signed-off-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/journal_io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c
index 77e93ad875d6..d5332283a75a 100644
--- a/fs/bcachefs/journal_io.c
+++ b/fs/bcachefs/journal_io.c
@@ -1672,6 +1672,7 @@ static CLOSURE_CALLBACK(journal_write_done)
new.unwritten_idx++;
} while ((v = atomic64_cmpxchg(&j->reservations.counter, old.v, new.v)) != old.v);
+ closure_wake_up(&w->wait);
completed = true;
}
@@ -1681,7 +1682,6 @@ static CLOSURE_CALLBACK(journal_write_done)
track_event_change(&c->times[BCH_TIME_blocked_journal_max_in_flight], false);
- closure_wake_up(&w->wait);
journal_wake(j);
}