bcachefs: make nocow lock waits SRCU-aware#659
Closed
Komzpa wants to merge 2 commits into
Closed
Conversation
This was referenced Jun 28, 2026
884525c to
896612e
Compare
Owner
|
Merged — cherry-picked onto master (36c7a31, authorship preserved). The SRCU-aware nocow waits are the right fix; the write.c caller was blocking under a held SRCU read lock. Followed it with a small cleanup commit on our side: since bch2_data_update_init() now takes @trans and the nocow path only runs with ctxt != NULL (promote path bails earlier), the |
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
btree_transinto blocking nocow lock waitstrans_wait_event()wrapper so long waits can drop SRCU via the current short-wait budgetbch2_trans_unlock_long()replacement from the conflicted kernel PRContext
This targets the nocow-write stall path reported in koverstreet/bcachefs#680, where writeback was blocked around
bch2_nocow_write()/ nocow locking while the transaction still held SRCU. It is also the narrow form of the maintainer direction on koverstreet/bcachefs#1069: start with the normal unlock path, but escalate long blocking waits through the transaction-aware wait helper instead of dropping SRCU unconditionally at every callsite.Tests
Validation
git diff --checkmake generate_version && BINDGEN=/home/kom/.cargo/bin/bindgen LIBCLANG_PATH=/usr/lib/llvm-18/lib CARGO_BUILD_JOBS=4 make -j4 bcachefsmake -C /lib/modules/$(uname -r)/build M=/home/kom/tmp/bcachefs-module-nocow-srcu-wait modules -j4896612eb72c2741ce554d147a65006475adfc042Related: koverstreet/bcachefs#1069