Bug #82196
closedosd: a slow shutdown can keep a PG referenced past its detach, and BlueStore::umount() asserts
0%
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
KB Updated by Kyle Bader about 1 month ago
- Pull request ID set to 73179
RZ Updated by Radoslaw Zarzynski about 1 month ago
- Status changed from New to Fix Under Review
KS Updated by Kamoltat (Junior) Sirivadhna 28 days ago
Added needs-qa flag
LF Updated by Laura Flores 21 days ago
Added to a batch.
LF Updated by Laura Flores 14 days ago
Same
UB Updated by Upkeep Bot 8 days ago
- 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
- 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
- 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
- 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