Skip to content

osd: rep_repair_primary_object needs to cope with balanced/localized reads - #70909

Merged
bill-scales merged 1 commit into
ceph:mainfrom
bill-scales:issue76957
Sep 18, 2026
Merged

bill-scales merged 1 commit into
ceph:mainfrom
bill-scales:issue76957

Conversation

@bill-scales

@bill-scales bill-scales commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

If a balanced/localized read is sent to a replica (as opposed to the primary) and this read then fails (e.g. because of a media error) then rep_repair_primary_object is called which previously asserted because recovery can only be performed by the primary.

Fix this by having replica's fail the op with EAGAIN back to the client rather than attempt recovery. The client will retry the request to the primary which will most likely read the data from another copy. If the primary needs to recover the object it may re-encounter and deal with the error as it processes the read, otherwise the next scrub cycle will find and deal with the error.

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

See also #69234 which is an alternative fix

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.

…reads

If a balanced/localized read is sent to a replica (as opposed to
the primary) and this read then fails (e.g. because of a media
error) then rep_repair_primary_object is called which previously
asserted because recovery can only be performed by the primary.

Fix this by having replica's fail the op with EAGAIN back to the
client rather than attempt recovery. The client will retry the
request to the primary which will most likely read the data from
another copy. If the primary needs to recover the object it
may re-encounter and deal with the error as it processes the
read, otherwise the next scrub cycle will find and deal with
the error.

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

Signed-off-by: Bill Scales <[email protected]>
Assisted-by: IBM Bob 2.0.1
@bill-scales
bill-scales requested a review from a team as a code owner August 7, 2026 09:29
Copilot AI balanced review requested due to automatic review settings August 7, 2026 09:29
@github-actions github-actions Bot added the core label Aug 7, 2026

Copilot AI 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.

Pull request overview

Prevents replica OSD crashes when repair-on-read encounters corruption during balanced/localized reads.

Changes:

  • Returns EAGAIN from replicas instead of asserting.
  • Redirects client retries to the primary OSD.

Comment thread src/osd/PrimaryLogPG.cc Resolved
Comment thread src/osd/PrimaryLogPG.cc Resolved
Comment thread src/osd/PrimaryLogPG.cc Resolved

@JonBailey1993 JonBailey1993 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.

Copilot's comment about the performance counter is interesting, but outside that, this looks good to me.

Comment thread src/osd/PrimaryLogPG.cc Resolved
@bill-scales
bill-scales requested a review from aainscow September 9, 2026 13:59

@aainscow aainscow 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.

It took me a while, as there is a lot of subtlety around this code, but I think it is correct.

  1. At the point this code is called "-EAGAIN" being returns essentially means "drop me" - but it looks like the non-primary sends the necessary reply, so handles this well.

  2. You can have EC DIRECT READS at a PRIMARY - this is moot because you cant fix EC objects like this at all...

  3. You can have balanced / localize reads at the primary... potentially split versions. But I think we can safely wait and repair the object at this point... or we won't be in here because we cant calculate a checksum on a non-full read.

Maybe the commit message could go into a bit more detail, but I think the code is correct.

@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath12-testing-20260911.231931-main.

@NitzanMordhai

Copy link
Copy Markdown
Contributor

@bill-scales

Copy link
Copy Markdown
Contributor Author

jenkins test api

@bill-scales
bill-scales merged commit 5820d71 into ceph:main Sep 18, 2026
16 of 19 checks passed
@github-actions

Copy link
Copy Markdown

This is an automated message by src/script/redmine-upkeep.py.

I found one or more Fixes: tags in the commit messages in

git log 5820d71f739489919c9e25cb5885d20b459bdd3c^..5820d71f739489919c9e25cb5885d20b459bdd3c

The referenced tickets are:

Those tickets do not reference this merged Pull Request. If this Pull Request merge resolves any of those tickets, please update the "Pull Request ID" field on each ticket. A future run of this script will appropriately update them.

Update Log: https://github.com/ceph/ceph/actions/runs/35367352963

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.

6 participants