Skip to content

os/bluestore/BlueFS: reserve the log-extension seq before releasing dirty.lock - #70892

Merged
ifed01 merged 4 commits into
ceph:mainfrom
ming1:wip-79068-bluefs-extend-log-seq-race
Aug 25, 2026
Merged

ifed01 merged 4 commits into
ceph:mainfrom
ming1:wip-79068-bluefs-extend-log-seq-race

Conversation

@ming1

@ming1 ming1 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

BlueFS can lose a file's op_file_update_inc when a log extension races with a
concurrent fsync(): _extend_log() bumps dirty.seq_live after
_flush_and_sync_log_LD() has already released dirty.lock, so a file
registered by _signal_dirty_to_log_D() in that window lands in a bucket that
no _consume_dirty() ever visits, and _clear_dirty_set_stable_D() later
erases it while marking the file clean. fsync() still returns success; after
a restart, journal replay reconstructs a stale fnode and RocksDB fails with
Corruption: file is too short ... to be an sstable.

Fix by reserving the extension transaction's seq atomically with the flush's
own seq advance, while dirty.lock is still held, so no fsync can ever
register a file under it. The async-compaction site no longer extends the log
itself; it flushes first when the runway is short.

Introduced by e97aa85 ("os/bluestore: fix bluefs log runway enospc");
affects v19.0.0 (Squid) and later, Reef is unaffected.

Validated with a deterministic reproducer (forced extension plus an injected
delay in the extension window; fails 3/3 before the fix with the replayed file
size stale, passes 3/3 after) — the reproducer patch is attached to the
tracker ticket. ceph_test_bluefs passes.

Fixes: https://tracker.ceph.com/issues/79068

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)

@ming1
ming1 requested a review from a team as a code owner August 6, 2026 15:46
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

16 similar comments
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ming1
ming1 force-pushed the wip-79068-bluefs-extend-log-seq-race branch from 68427d5 to 72d0690 Compare August 6, 2026 23:34
@xiubli

xiubli commented Aug 7, 2026

Copy link
Copy Markdown
Member

ok to test

@xiubli

xiubli commented Aug 7, 2026

Copy link
Copy Markdown
Member

jenkins test api

1 similar comment
@xiubli

xiubli commented Aug 7, 2026

Copy link
Copy Markdown
Member

jenkins test api

@ming1

ming1 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@ming1

ming1 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

2 similar comments
@ming1

ming1 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@ming1

ming1 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@xiubli

xiubli commented Aug 11, 2026

Copy link
Copy Markdown
Member

jenkins test api

@xiubli

xiubli commented Aug 11, 2026

Copy link
Copy Markdown
Member

jenkins test make check arm64

@xiubli

xiubli commented Aug 11, 2026

Copy link
Copy Markdown
Member

jenkins test make check

@xiubli

xiubli commented Aug 11, 2026

Copy link
Copy Markdown
Member

jenkins test windows

…irty.lock

_extend_log() bumps dirty.seq_live after _flush_and_sync_log_LD() has
already released dirty.lock. A file that a concurrent
_signal_dirty_to_log_D() registers under the pre-bump seq_live is
stranded: _consume_dirty() does an exact find(seq) and never visits
that bucket, and _clear_dirty_set_stable_D() later erases it while
marking the file clean. The file's op_file_update_inc never reaches
the journal even though fsync() returned success; after a restart,
replay reconstructs a stale fnode and RocksDB reports 'Corruption:
file is too short ... to be an sstable'.

Introduced by e97aa85 ("os/bluestore: fix bluefs log runway
enospc"), first released in v19.0.0; Reef is unaffected.

Fix by keeping all seq_live updates under dirty.lock:

- split _maybe_extend_log() into _need_extend_log() and _extend_log();
- _flush_and_sync_log_LD() reserves a dedicated seq for the extension
  transaction atomically with its own seq advance, so no fsync can
  ever register a file under it; _extend_log() only steps log.t.seq;
- the async-compaction site no longer extends the log itself; if the
  runway is short it flushes the log first, which extends it as a
  side effect.

Fixes: https://tracker.ceph.com/issues/79068
Signed-off-by: Ming Lei <[email protected]>
@ming1
ming1 force-pushed the wip-79068-bluefs-extend-log-seq-race branch from 72d0690 to 4040556 Compare August 18, 2026 01:32
@ming1

ming1 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

jenkins test windows

Comment thread src/os/bluestore/BlueFS.cc Resolved
Comment thread src/os/bluestore/BlueFS.cc Resolved
ming1 and others added 3 commits August 19, 2026 05:00
_extend_log() waits out log_forbidden_to_expand after its caller has
already advanced/reserved log seqs. The wait releases log.lock, so a
concurrent flusher can enter and trip the log.t.seq == log.seq_live
assert in _log_advance_seq(); without that assert it would flush the
shared log.t under later seqs and the parked seqs would be appended
out of order, which replay silently treats as end-of-log.

Restore the wait-before-reservation design of 08cf6d0
("os/bluestore/bluefs: Split single bluefs lock into multiple smaller
locks"): _flush_and_sync_log_LD() composes log.t first and, only when
the transaction needs to extend the log while expansion is forbidden,
parks on log_cond with no seq reserved, re-evaluating from scratch on
wakeup - re-consuming is safe because already-consumed files re-encode
as empty deltas. _extend_log()'s wait becomes an assert: the flag is
only set under log.lock, which the caller now holds from the check
onward. Flushers that fit the runway never wait, so flush vs async
compaction concurrency is unchanged.

_flush_and_sync_log_LD() now holds log.lock through a single
unique_lock: the wait uses the predicate form of
condition_variable::wait(), and the early return and the post-flush
release fall out of RAII instead of explicit unlock calls.

Fixes: e97aa85 ("os/bluestore: fix bluefs log runway enospc")
Signed-off-by: Ming Lei <[email protected]>
@ming1
ming1 force-pushed the wip-79068-bluefs-extend-log-seq-race branch from 4040556 to aa95664 Compare August 19, 2026 10:38
@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath7-testing-20260824.015917-main.

@NitzanMordhai

Copy link
Copy Markdown
Contributor

@ifed01
ifed01 merged commit c12b0ff into ceph:main Aug 25, 2026
7 checks passed
haynes-dev-bot Bot added a commit to thaynes43/haynes-ops that referenced this pull request Sep 12, 2026
…d crashes (#2863)

Ceph keeps RECENT_CRASH raised until a crash record is archived, so a daemon
that recovered in seconds still re-pages every 12h for two weeks; on 2026-09-11
one osd.3 BlueFS assert (20.2.4) paged three times before a session archived it
by hand. The responder had diagnosed it correctly but answered `investigate`
(a page) because no runbook said the rem lane may act.

- .agents/runbooks/ceph-daemon-crash.md: responder answers `urgent` (the handoff
  verb); the rem-* lane inspects each `ceph crash ls-new` id, verifies the daemon
  is serving and PGs are clean, checks dev-env activity, runs a pattern gate
  (repeat entity/stack_sig, quorum or mgr loss, daemon still down, >3 records
  => escalate), archives per id, waits out the mgr crash-module timer, confirms
  the alert dropped, and closes with a greppable digest line. Known signatures
  recorded, including the 09-11 assert and its nearest upstream (ceph/ceph#70892,
  tentacle backport #71593 open).
- ops-claude.md: adds `rem-*` to the taxonomy and the autonomous remediation
  contract that session-launch.sh's rem prompt has pointed at since 08-23 but
  which did not exist.
- .agents/runbooks/agentic-remediation.md: the lane overview + decision table
  that remediate.sh, ops-digest.sh and dev-activity-check.sh already cite.
- respond.sh: `urgent` is also the answer whenever a runbook under
  .agents/runbooks/ says the rem lane may handle the alert unattended, even when
  nothing is on fire; never downgrade a runbook-covered alert to `investigate`.
- Index and cross-links (.agents/README.md, CLAUDE.md, known-noise,
  health-gate, tier4 playbooks, alert-responder.md — whose pod table and
  "not wired" paragraph were stale since the 08-23 handoff landed).

Blast radius: ops-claude.md rides the dev-env-ops-scripts ConfigMap, so the
merge rolls the dev-env-ops pod (ns upgrade-agent) only; respond.sh lands on
the next 10-min responder run. The dev-env pod is untouched.


Claude-Session: https://claude.ai/code/session_0137V3ZjnmZjrufrB25EzJpk

Co-authored-by: haynes-dev-bot[bot] <haynes-dev-bot[bot]@users.noreply.github.com>
Co-authored-by: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants