bcachefs: fix lost journal buf wakeup due to improved pipelining
authorBrian Foster <bfoster@redhat.com>
Fri, 1 Mar 2024 17:49:24 +0000 (12:49 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Thu, 14 Mar 2024 01:22:26 +0000 (21:22 -0400)
commitada02c207c0168e0e9173983d00f82c9b5de90c8
tree473b55466587265a9dd86676a6e9a9ca96045228
parent2a68d611a17b8135ade5f7016144ef34af0a61a4
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>
fs/bcachefs/journal_io.c