]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
bcachefs: Fix write buffer flushing from open journal entry
authorKent Overstreet <kent.overstreet@linux.dev>
Tue, 22 Jul 2025 03:41:50 +0000 (23:41 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Fri, 25 Jul 2025 02:56:37 +0000 (22:56 -0400)
When flushing the btree write buffer, we pull write buffer keys directly
from the journal instead of letting the journal write path copy them to
the write buffer.

When flushing from the currently open journal buffer, we have to block
new reservations and wait for outstanding reservations to complete.

Recheck the reservation state after blocking new reservations:
previously, we were checking the reservation count from before calling
__journal_block().

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/journal.c

index f22b05e02c1e6e4a54061f1824277d99c7207b70..ddfeb0dafc9d845a2d85af00e50fd9f4a93d0a79 100644 (file)
@@ -1082,6 +1082,7 @@ static struct journal_buf *__bch2_next_write_buffer_flush_journal_buf(struct jou
 
                        if (open && !*blocked) {
                                __bch2_journal_block(j);
+                               s.v = atomic64_read_acquire(&j->reservations.counter);
                                *blocked = true;
                        }