Skip to content

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

Open
ifed01 wants to merge 4 commits into
ceph:tentaclefrom
ifed01:wip-79068-bluefs-extend-log-seq-race-tent
Open

ifed01 wants to merge 4 commits into
ceph:tentaclefrom
ifed01:wip-79068-bluefs-extend-log-seq-race-tent

Conversation

@ifed01

@ifed01 ifed01 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Parent tracker: https://tracker.ceph.com/issues/79068
Backport tracker: https://tracker.ceph.com/issues/79834
Backports: #70892

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

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)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

ming1 and others added 4 commits September 7, 2026 18:51
…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]>
(cherry picked from commit 2499b4a)
_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]>
(cherry picked from commit adf1141)
Signed-off-by: Igor Fedotov <[email protected]>
(cherry picked from commit aa95664)
@ifed01
ifed01 requested a review from a team as a code owner September 7, 2026 15:59
@ifed01
ifed01 requested review from aclamk and ming1 September 7, 2026 15:59
@github-actions github-actions Bot added this to the tentacle milestone Sep 7, 2026
@github-actions github-actions Bot added the releng-audit-pass Release engineering: passed backport verification audit. label Sep 7, 2026
@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath22-testing-20261014.084453-tentacle.

@NitzanMordhai

Copy link
Copy Markdown
Contributor

@batrick batrick modified the milestones: tentacle, v20.2.6 Nov 25, 2026
@batrick

batrick commented Nov 25, 2026

Copy link
Copy Markdown
Member

jenkins test api

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bluestore core needs-qa releng-audit-pass Release engineering: passed backport verification audit. wip-bharath22-testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants