Project

General

Profile

Actions

Bug #82196

closed
KB

osd: a slow shutdown can keep a PG referenced past its detach, and BlueStore::umount() asserts

Bug #82196: osd: a slow shutdown can keep a PG referenced past its detach, and BlueStore::umount() asserts

Added by Kyle Bader about 1 month ago. Updated about 6 hours ago.

Status:
Backporting
Priority:
Normal
Assignee:
-
Category:
Correctness/Safety
Target version:
-
Due date:
% Done:

0%

Source:
Backport:
umbrella
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Component(RADOS):
Pull request ID:
Tags (freeform):
Fixed In:
v22.0.0-1489-g7a34eab0f9
Released In:
Upkeep Timestamp:
2026-12-03T14:36:17+00:00

Description

With osd_fast_shutdown=false, OSD::shutdown() sometimes finds a PG
still referenced when it detaches it, and BlueStore::umount() then
asserts on the reference count of the PG's collection:

osd.0 24 pgid 1.0s1 has ref count of 2
../src/os/bluestore/BlueStore.cc: 20372: FAILED ceph_assert(p.second->get_nref() == 1)
 2: (BlueStore::umount()+0x2a6)
 3: (OSD::shutdown()+0x1857)

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 comes after the op threads stopped, its
callback stays in the queue, and keeps the PG and its collection past
the umount.

We saw it in 3 of 20 runs of a standalone test that stops an OSD with
osd_fast_shutdown=false. The test is part of an S3 over RDMA branch,
but the race is in the shutdown code of main.

Fix

OSD::shutdown() waits until the transactions of each PG committed,
after it shuts the PGs down and while the op threads still run. After
the fix, 60 of 60 runs of three such tests passed.

Affected versions: main


Related issues 1 (1 open — 0 closed)

Copied to RADOS - Backport #83978: umbrella: osd: a slow shutdown can keep a PG referenced past its detach, and BlueStore::umount() assertsFix Under ReviewAlex Ainscow

Actions

KB Updated by Kyle Bader about 1 month ago Actions #1

  • Pull request ID set to 73179

RZ Updated by Radoslaw Zarzynski about 1 month ago Actions #2

  • Status changed from New to Fix Under Review

KS Updated by Kamoltat (Junior) Sirivadhna 28 days ago Actions #3

Added needs-qa flag

LF Updated by Laura Flores 21 days ago Actions #4

Added to a batch.

LF Updated by Laura Flores 14 days ago Actions #5

Same

UB Updated by Upkeep Bot 8 days ago Actions #6

  • Status changed from Fix Under Review to Resolved
  • Merge Commit set to 7a34eab0f9ade11c172245e89620f83f039fd537
  • Fixed In set to v22.0.0-1489-g7a34eab0f9
  • Upkeep Timestamp set to 2026-11-25T14:31:58+00:00

AA Updated by Alex Ainscow about 6 hours ago Actions #7

  • Status changed from Resolved to Pending Backport
  • Backport set to umbrella

Needed in umbrella: the same _shutdown_cache assert shows up on an umbrella-based downstream build when OSDs get SIGTERM under writes with osd_fast_shutdown=false. The fix cherry-picks cleanly onto umbrella.

AA Updated by Alex Ainscow about 6 hours ago Actions #8

  • Copied to Backport #83978: umbrella: osd: a slow shutdown can keep a PG referenced past its detach, and BlueStore::umount() asserts added

UB Updated by Upkeep Bot about 6 hours ago Actions #9

  • Status changed from Pending Backport to Backporting
  • Upkeep Timestamp changed from 2026-11-25T14:31:58+00:00 to 2026-12-03T14:36:17+00:00
Actions

Also available in: PDF Atom