Skip to content

osd: wait for the last commits of the PGs before the op threads stop - #73179

Merged
SrinivasaBharath merged 1 commit into
ceph:mainfrom
mmgaggle:wip-kbader-osd-shutdown-commits
Nov 25, 2026
Merged

SrinivasaBharath merged 1 commit into
ceph:mainfrom
mmgaggle:wip-kbader-osd-shutdown-commits

Conversation

@mmgaggle

Copy link
Copy Markdown
Member

Summary

In a slow shutdown (osd_fast_shutdown=false), a PG was sometimes still referenced at its detach in OSD::shutdown() ("has ref count of 2"). BlueStore::umount() then failed its assert on the reference count of the PG's collection.

The map that marks the stopping OSD down starts a new interval in each PG, just as the shutdown begins. The on-commit callback of that peering transaction holds a FlushState, and the FlushState holds the PG. PG::shutdown() waits until the transactions of the PG are submitted, not until they commit.

The store queues the on-commit callbacks of a PG to the context queue of its shard. The op threads of a stopping OSD delete them. When the commit came after the op threads stopped, its callback stayed in the queue and kept the PG and its collection past the umount.

Now OSD::shutdown() waits until the transactions of each PG committed, after it shut the PGs down and while the op threads still run. The op threads delete the waiter instead of running it, so the waiter signals at its release. The wait takes as long as the last commits, a few milliseconds.

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

Testing

The assert showed in the slow-stop standalone tests of the S3 over RDMA series (#73164). Before the fix, 3 of 20 runs of one of these tests hit the assert at umount. After it, all 60 runs of three such tests passed. Those runs were on an older main. This pull request adds no test.

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)

A slow shutdown (osd_fast_shutdown=false) could leave a PG referenced
when OSD::shutdown() detached it ("has ref count of 2"), and
BlueStore::umount() then failed its assert on the reference count of
the PG's collection.

The map that marks the stopping OSD down starts a new interval in each
PG just as the shutdown begins. The on-commit callback of that peering
transaction holds a FlushState, and the FlushState holds the PG.
PG::shutdown() waits until the transactions of the PG are submitted,
not until they commit. The store queues the on-commit callbacks of a
PG to the context queue of its shard, where the op threads of a
stopping OSD delete them. When the commit came after the op threads
had stopped, its callback stayed in the queue and kept the PG, and the
PG's collection, past the detach of the PG and the umount of the store.

Now OSD::shutdown() waits until the transactions of each PG have
committed, after it shut the PGs down and while the op threads still
run. The waiter signals when it is released, because the op threads
delete it instead of running it. The wait takes as long as the last
commits, a few milliseconds.

Fixes: https://tracker.ceph.com/issues/82196
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Kyle Bader <[email protected]>
@mmgaggle
mmgaggle requested a review from a team as a code owner October 27, 2026 22:32
@github-actions github-actions Bot added the core label Oct 27, 2026
@mmgaggle mmgaggle mentioned this pull request Oct 27, 2026
5 of 14 tasks
@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath10-testing-20261109.054620-main.

@lee-j-sanders

Copy link
Copy Markdown
Member

@SrinivasaBharath
SrinivasaBharath merged commit 7a34eab into ceph:main Nov 25, 2026
18 checks passed
@github-actions

Copy link
Copy Markdown

This is an automated message by src/script/redmine-upkeep.py.

I have resolved the following tracker ticket due to the merge of this PR:

No backports are pending for the ticket. If this is incorrect, please update the tracker
ticket and reset to Pending Backport state.

Update Log: https://github.com/ceph/ceph/actions/runs/45634730867

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.

5 participants