Bug #79799
closedWrite ordering issue caused by error injects with scrub blocked writes
0%
Description
I hit a write ordering issue due to the following circumstances during my testing:
- 50.59.785: replica_scrub sets m_scrubber’s m_start to 0 and m_end to MAX (Caused by scrub starting - priority set to highest because we have failed to run 5 times already due to writes).
- 50:59.896: ScrubMachine calls ReplicaActive::exit() due to new interval
- 50:59.896: ScrubMachine transitions to NotActive
- ~~~~~~: ScrubMachine - several transitions between ReplicaActive/ReplicaIdle and NotActive. None call through to reset_internal_state.
- 51.14.558: Read 36354 dequeued
- 51.14.559: Write 36357 dequeued
- 51.14.560: Write 36357 is blocked because read 36354 holds the lock for reading.
- 51.14.563: Read 36354 completes
- 51.14.563: Write 36357 removed from the waiters list, but blocked by scrub due to soid being between m_start and m_end, so added to the waiting_for_scrub list.
- 51.14.565: Write 36358 dequeued. Doesn’t get blocked by scrub as scrub is not active (checks are different between the two places)
- 51.14.669: Write 36358 completes
- 51.15.277: ScrubMachine Destructs PrimaryActive as part of on_new_interval, which calls through to reset_internal_state which resets m_start and m_end
- 51.15.277: Scrub Machine transitions from PrimaryActive/PrimaryIdle to NotActive Scrub reset_internal_state caused by new epoch
- 51:16.293 Write 36357 dequeued
- 51:16.~~~ Write 36357 completes
- 51:18.498: Read 36411 dequeued. Read covers the 2k which 36367 overwrote 36358. Detected as a miscompare.
I believe the issues are as follows:
1. We are not resetting the m_start and m_end values when we transition out of the ReplicaActive/ReplicaIdle states
2. We are checking if we are blocked by scrubbing in two different ways. One way in the IO path, and differently everywhere else (including requeue path). This is what allowed the second op to be sent while the original op was only allowed to be queued.
I have created a PR that attempts to solve this here: https://github.com/ceph/ceph/pull/71187
JB Updated by Jonathan Bailey 3 months ago
- Subject changed from Write ordering issue to Write ordering issue caused by error injects with scrub blocked writes
JB Updated by Jonathan Bailey 3 months ago
- Description updated (diff)
YO Updated by Yuma Ogami 3 months ago
I came across this PR and I'm a bit concerned about this issue. Could I ask a few questions?
1. Affected versions: Which Ceph versions are impacted by this issue?
2. Likelihood in normal use: As a user, I'd like to understand how seriously I should take this. Is this something that can happen during normal operation, or does it only occur when several specific conditions line up (making it rare in practice)?
3. Workaround: Is there any known workaround until this fix is merged and backported?
JB Updated by Jonathan Bailey 3 months ago
This rare condition can cause outstanding writes to be re-ordered against other outstanding writes to the same object. While such strict write ordering is a guarantee that Ceph offers, most other block/file implementations do perform such re-ordering. Because of this, it is rare for an application to rely on the Ceph ordering guarantees. In addition, RGW objects are immutable, so you wouldn't see overwrites of a range in this same way for RGW. The test which revealed this problem was a purpose built ceph-only application, which was explicitly relying on write ordering. At the same time, exceptionally heavy levels of cluster instability were being artificially injected at levels that you wouldn't see on a real system. As such, it is unlikely, but not impossible, that your applications are affected.
RZ Updated by Radoslaw Zarzynski 3 months ago
Assigned Ronen as reviewer.
LF Updated by Laura Flores 3 months ago
- Status changed from New to Fix Under Review
LF Updated by Laura Flores 3 months ago
PR still needs reviews.
RF Updated by Ronen Friedman 3 months ago
- Backport set to squid,tentacle,umbrella
LF Updated by Laura Flores 3 months ago
PR added to a QA batch.
LF Updated by Laura Flores 2 months ago
- Status changed from Fix Under Review to Resolved
UB Updated by Upkeep Bot 2 months ago
- Merge Commit set to 1ed1aab50c31c247fc8a8fa523d5c92925a268cf
- Fixed In set to v21.3.0-3592-g1ed1aab50c
- Upkeep Timestamp set to 2026-09-23T23:23:16+00:00
JB Updated by Jonathan Bailey 2 months ago
- Status changed from Resolved to Pending Backport
UB Updated by Upkeep Bot 2 months ago
- Copied to Backport #81113: squid: Write ordering issue caused by error injects with scrub blocked writes added
UB Updated by Upkeep Bot 2 months ago
- Copied to Backport #81114: tentacle: Write ordering issue caused by error injects with scrub blocked writes added
UB Updated by Upkeep Bot 2 months ago
- Copied to Backport #81115: umbrella: Write ordering issue caused by error injects with scrub blocked writes added
UB Updated by Upkeep Bot 2 months ago
- Status changed from Pending Backport to Backporting
- Upkeep Timestamp changed from 2026-09-23T23:23:16+00:00 to 2026-09-29T12:30:56+00:00