Skip to content

osd/PrimaryLogPG: take an op's PG log version after its ops have run - #73326

Merged
MattyWilliams22 merged 2 commits into
ceph:mainfrom
aainscow:wip-ec-coroutine-version-race
Nov 23, 2026
Merged

MattyWilliams22 merged 2 commits into
ceph:mainfrom
aainscow:wip-ec-coroutine-version-race

Conversation

@aainscow

Copy link
Copy Markdown
Contributor

On a pool with EC optimizations, an op with a CALL runs in a coroutine, and a cls read in it yields until the EC read completes. execute_ctx() took the op's PG log version before running the ops. While the CALL waits, the PG lock is free, and work that does not go through do_op() can take versions: the snap trimmer, watch timeouts, and ops whose async reads complete. The CALL then submits a version that is already used, and the primary aborts in issue_repop(), on at_version >= projected_last_update or on PGLog's e.version > head.

The version is now taken in prepare_transaction() after do_osd_ops() returns, where the op can no longer yield.

The new TestClsRbd.object_map_update_while_a_write_reads reproduces it: on main its FastEC case aborts the primary at PGLog.h:675.

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

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

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)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

🤖 Raised by Claude Code.

execute_ctx() took the op's PG log version (projected_last_update + 1)
before running the ops. On a pool with EC optimizations an op with a
CALL runs in a coroutine, and a cls read in it yields until the EC read
completes. While it waits the PG lock is free, and work that does not
go through do_op() can take versions: the snap trimmer, watch timeouts,
and ops whose async reads complete. The CALL then submits a version that
is already used, and the primary aborts in issue_repop(), on
at_version >= projected_last_update or on PGLog's e.version > head.

Take the version in prepare_transaction() after do_osd_ops() returns,
where the op can no longer yield.

Fixes: https://tracker.ceph.com/issues/82471
Assisted-by: Claude Code
Signed-off-by: Matty Williams <[email protected]>
On a FastEC pool, a write with a cmpext waits for its EC read while an
object map update, a CALL, takes its version and yields on its own read.
The write's read completes first, so the write takes a version too. A
primary that then reuses a version aborts, and the ops are resent to the
next primary and succeed, so the test also checks that no OSD went down.

Fixes: https://tracker.ceph.com/issues/82471
Assisted-by: Claude Code
Signed-off-by: Matty Williams <[email protected]>
@MattyWilliams22
MattyWilliams22 force-pushed the wip-ec-coroutine-version-race branch from ee09e07 to e227c19 Compare November 2, 2026 12:09
@MattyWilliams22

Copy link
Copy Markdown
Contributor

I've reviewed this code which was written by Claude. I believe that the code is valid, solves and tests a real problem, so I have signed it off in my name.

@aainscow
aainscow marked this pull request as ready for review November 2, 2026 13:38
@aainscow
aainscow requested review from a team as code owners November 2, 2026 13:38
@MattyWilliams22

Copy link
Copy Markdown
Contributor

jenkins test make check

@MattyWilliams22
MattyWilliams22 removed their request for review November 3, 2026 10:13
@MattyWilliams22

Copy link
Copy Markdown
Contributor

jenkins test make check

@bill-scales bill-scales left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - Only affects EC pools being used with I/O requests that include read class ops. This has only been supported since umbrella and requires an EC pool to be used for metadata where previously the only choice was to use a Replica pool.

@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

@MattyWilliams22
MattyWilliams22 merged commit 704adc4 into ceph:main Nov 23, 2026
17 checks passed
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