Project

General

Profile

Actions

Bug #81205

closed
AA AA

osdc/Objecter: In flight reads with RWORDERED can overtake writes on a full pool

Bug #81205: osdc/Objecter: In flight reads with RWORDERED can overtake writes on a full pool

Added by Alex Ainscow 2 months ago. Updated 21 days ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Due date:
% Done:

0%

Source:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Component(RADOS):
Pull request ID:
Tags (freeform):
Fixed In:
v22.0.0-810-g9292fdc725
Released In:
Upkeep Timestamp:
2026-11-12T22:15:07+00:00

Description

A client that sets ORDER_READS_WRITES (which sets CEPH_OSD_FLAG_RWORDERED) expects its reads and writes to one object to complete in submission order. That ordering breaks when the pool or the cluster becomes full.

When the pool is full, the Objecter pauses write ops. It holds them and sends them only once the full condition clears. It does not pause RWORDERED reads, although they should wait on the full flag too: Objecter::target_should_be_paused() only applies the full check to ops with CEPH_OSD_FLAG_WRITE. The sequence is:

1. The client submits one or more writes to an object (tids 1 and 2).
2. The pool goes full, for example because an OSD reaches failsafe-full or a pool quota is hit. The Objecter pauses the writes, either before sending them or when it resends them after the map change.
3. The client submits an RWORDERED read of the same object (tid 3). The Objecter sends it at once, or resends it at once if it was already in flight.
4. The OSD serves the read and the client sees it complete while the earlier writes are still paused.
5. When the pool is no longer full, the writes are sent and complete after the read.

So the read overtakes writes that were submitted before it. Depending on timing, it can return data from before those writes.

This was seen with ceph_test_rados, which aborted with finished tid 1 when last_acked_tid was 3 when an OSD went failsafe-full. That message means write tid 1 completed after read tid 3 had already been acknowledged. The same reordering was reproduced on a replicated pool by setting and clearing a pool quota, so it doesn't depend on EC or stretch mode.

LF Updated by Laura Flores 2 months ago Actions #1

  • Status changed from New to In Progress

@Alex Ainscow would you mind pasting the details of your ceph_test_rados reproducer?

RZ Updated by Radoslaw Zarzynski 2 months ago Actions #2

Nice cornercase!

AA Updated by Alex Ainscow 2 months ago · Edited Actions #3

  • Pull request ID set to 72289

@Laura Flores See the last commit of the newly added PR for a test-harness reproducer.

The test was found as part of stretch-EC test work. It happened at the end of a simple-but-aggressive "chaos" script which injects lots of horrible conditions simultaneously on a vstart cluster. However the recreate was straight forward:

(From Claude:)
The setup. It ran against the vstart cluster that the chaos run had been using, with the c2 binaries:
ceph osd pool create f10 replicated --pg_num 4
ceph osd pool set f10 size 2
That's a small plain replicated pool, deliberately with no EC and no zones, to show the bug has nothing to do with stretch.

The client:
ceph_test_rados --pool f10 --max-ops 100000 --objects 4 --max-in-flight 2 \
--size 20000 --max-seconds 240 --op write 100
Pulse "full" on the pool: repeatedly switching the pool between full and not full, while the client runs in the background:
for i in 1 2 3 4 5 6 7 8; do
sleep 10
ceph osd pool set-quota f10 max_objects 1 # pool goes full
sleep 6
ceph osd pool set-quota f10 max_objects 0 # quota removed, not full
kill -0 $client_pid || break # stop once the client dies
done

- On: max_objects 1 puts the pool over quota, since it already holds up to 4 objects. Within a few seconds the monitor publishes an OSDMap with the pool marked full. That's the same pool full flag the Objecter checks when a real OSD fills up, as osd.7 did in the chaos run.
- Off: max_objects 0 means no quota, and the next map clears the flag. The Objecter then resends the ops it had paused.
- Timing: the pool is full for about 6 seconds, then normal for 10. A quota avoids actually filling disks, so it's instant, repeatable and fully reversible.

What goes wrong in each pulse. When the full map arrives, the Objecter pauses the write ops but not the RWORDERED read that follows them. The read is sent (or resent) at once and completes. The paused writes only complete after the pulse ends. So the client sees a later tid finish before an earlier one.

The result:
- Before the fix (c2): the client aborted with Error: finished tid 1 when last_acked_tid was 4 (runs/F10-live-repro.log). tid 4 (the read) finished while write tid 1 was still paused.
- After the fix (c3): the same pulse loop ran to the end and the client exited 0.

The same 25 lines of shell would make a quick standalone reproducer, or a teuthology task, for the upstream PR.

AA Updated by Alex Ainscow 2 months ago Actions #4

  • Assignee set to Alex Ainscow

LF Updated by Laura Flores about 2 months ago Actions #5

PR under review (scrub note)

LF Updated by Laura Flores about 2 months ago Actions #6

  • Status changed from In Progress to Fix Under Review

KS Updated by Kamoltat (Junior) Sirivadhna about 2 months ago Actions #7

scrub note: waiting for second reviewer

LF Updated by Laura Flores about 1 month ago Actions #8

Pulled PR from testing since it got updates since being added to a batch.

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

In QA.

RZ Updated by Radoslaw Zarzynski 28 days ago Actions #10

Ditto.

RZ Updated by Radoslaw Zarzynski 21 days ago Actions #11

  • Status changed from Fix Under Review to Resolved

UB Updated by Upkeep Bot 21 days ago Actions #12

  • Merge Commit set to 9292fdc725f6709bcc105a80d950ed62ef7bbb90
  • Fixed In set to v22.0.0-810-g9292fdc725
  • Upkeep Timestamp set to 2026-11-12T22:15:07+00:00
Actions

Also available in: PDF Atom