Skip to content

bcachefs: use SRCU-aware waits after dropping locks#710

Closed
Komzpa wants to merge 1 commit into
koverstreet:masterfrom
Komzpa:komzpa/srcu-aware-wait-next
Closed

bcachefs: use SRCU-aware waits after dropping locks#710
Komzpa wants to merge 1 commit into
koverstreet:masterfrom
Komzpa:komzpa/srcu-aware-wait-next

Conversation

@Komzpa

@Komzpa Komzpa commented Jun 29, 2026

Copy link
Copy Markdown

Summary

  • use trans_wait_event() for the btree write throttling wait after drop_locks_do()
  • use trans_wait_event() for the journal-low-space wait before btree update reservation
  • keep the normal bch2_trans_unlock() fast path from drop_locks_do(), while letting long waits drop SRCU through the existing transaction-aware wait helper

Context

This is a narrow follow-up to koverstreet/bcachefs#1069 and #659.

The earlier PR #659 handled the nocow-lock wait path. This patch covers the remaining direct closure_wait_event() calls inside drop_locks_do(trans, ...) scopes. drop_locks_do() already drops btree locks with bch2_trans_unlock(), but it does not drop the transaction SRCU read lock before the wrapped wait. Reusing trans_wait_event() keeps short waits cheap and escalates only if the wait outlives the transaction short-wait budget.

Validation

  • git diff --check
  • make generate_version && BINDGEN=/home/kom/.cargo/bin/bindgen LIBCLANG_PATH=/usr/lib/llvm-18/lib CARGO_BUILD_JOBS=4 make -j4 bcachefs
  • safe staged kbuild module compile without unload/install side effects:
    make -C /lib/modules/$(uname -r)/build M=/home/kom/tmp/bcachefs-module-srcu-aware-wait-next modules -j4
  • GitHub Actions: Nix Flake actions run 28428366238, 17/17 jobs passed on head bd0506446be2b8186975c1edce51db30a20274cf

@Komzpa Komzpa force-pushed the komzpa/srcu-aware-wait-next branch from bf9036c to bd05064 Compare June 30, 2026 07:39
@koverstreet

Copy link
Copy Markdown
Owner

Merged — cherry-picked onto master (e2097c2, authorship preserved, retitled btree:). Both waits sit inside drop_locks_do() with SRCU still held, so the indefinite closure_wait_event() stalled the grace period; trans_wait_event() is the SRCU-aware fix. Thanks!

@koverstreet koverstreet closed this Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants