tests/bcachefs: test journal flush SRCU liveness - #99
Open
Komzpa wants to merge 2 commits into
Open
Conversation
Komzpa
force-pushed
the
agent/pr783-journal-srcu-20260718
branch
from
August 7, 2026 17:56
0bcd33e to
59c1c8e
Compare
Add a standalone bcachefs ktest for the issue #783 shape: delayed journal flushes, a constrained move write window, destination fsync pressure, and source device evacuation. The test keeps BCACHEFS_DEBUG enabled, clears dmesg immediately before the stress window, and fails if the workload emits either 'btree trans held srcu lock' or 'bch2_journal_flush_seq stuck?'. It also treats a timed-out evacuate or read-only shutdown as a liveness failure and dumps journal/reconcile/moving context state for diagnosis.
Komzpa
force-pushed
the
agent/pr783-journal-srcu-20260718
branch
from
August 16, 2026 21:29
59c1c8e to
9e48127
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
journal_flush_srcu_liveness.ktestfor the SRCU/journal-liveness shape inkoverstreet/bcachefs-tools#783.
The test mounts a 3-device debug bcachefs filesystem, delays journal flushes,
constrains move writeback concurrency, runs foreground
fiopressure, andevacuates a source device. It fails if the stress window emits either:
btree trans held srcu lockbch2_journal_flush_seq stuck?After the stress window it remounts read-only, unmounts, runs
bcachefs fsck -ny, and checks for bcachefs leak/error/device-error reports.Current Source-PR Status
This was originally paired with
koverstreet/bcachefs-tools#790, but that PR is now
closed after upstream review rejected the broad SRCU-unlock approach and split
the useful pieces out.
The surviving source-side journal-reclaim work is
koverstreet/bcachefs-tools#792. This ktest should not be
read as a red-to-green reproducer for that PR: it is a regression/smoke oracle
for the journal-flush/SRCU liveness invariant from
koverstreet/bcachefs-tools#783.
Scope Update After Coverage Audit
This is not a failing reproducer for
koverstreet/bcachefs-tools#783. It passes unpatched
origin/testingat838ead8957377100c58b501fc1c50816cb7e7da2as well as thehistorical
koverstreet/bcachefs-tools#790branch, so there is no red-to-greentransition.
I also tried a closer member-stall prototype that suspends a source member with
dmsetup suspendduringbcachefs device evacuate. The initial oracle treatedany
bch2_journal_flush_seq stuck?as failure, but that is too strict when thetest deliberately suspends a member for longer than the journal warning
threshold. With the oracle narrowed to post-resume non-recovery or
btree trans held srcu lock, the prototype passes current unpatchedkoverstreet/bcachefs-toolsorigin/testing, while still showing the expectedjournal-stuck diagnostics during the artificial suspend.
That prototype is therefore not included in this PR as a regression test.
Testing
git diff --check origin/master..HEADbash -n tests/fs/bcachefs/journal_flush_srcu_liveness.ktesttests/fs/bcachefs/journal_flush_srcu_liveness.ktest list-teststests/fs/bcachefs/journal_flush_srcu_liveness.ktest depskoverstreet/bcachefs-toolsorigin/testingat
838ead8957377100c58b501fc1c50816cb7e7da2, confirming this is not a redreproducer:
version: v1.38.8-161-g838ead895737========= PASSED journal_flush_srcu_liveness in 69sTEST SUCCESSfd929bb4241a885b8ce62f0f5b2412f247b13699:version: v1.38.8-162-gfd929bb4241a========= PASSED journal_flush_srcu_liveness in 24sTEST SUCCESSbtree trans held srcu lockbch2_journal_flush_seq stuck?koverstreet/bcachefs-tools#790source head58f07184dbe66dcfa01d8ef021d1326fa4027a2f:version: v1.38.8-182-g58f07184dbe6========= PASSED journal_flush_srcu_liveness in 114sTEST SUCCESSbtree trans held srcu lockbch2_journal_flush_seq stuck?VM proof
VM run against master bcachefs-tools (kernel 7.2.0-rc4):
journal_flush_srcu_livenessPASSED in 32s -- delayed journal flushes plus constrained move-writeback concurrency and foreground fio pressure on a 3-device debug fs completed without an SRCU/journal-liveness warning, source evacuated.