Skip to content

osd/PeeringState: ignore stale backfill reservation replies - #74340

Open
yulongshi0816 wants to merge 1 commit into
ceph:mainfrom
yulongshi0816:wip-osd-backfill-reservation-stale-replies
Open

yulongshi0816 wants to merge 1 commit into
ceph:mainfrom
yulongshi0816:wip-osd-backfill-reservation-stale-replies

Conversation

@yulongshi0816

@yulongshi0816 yulongshi0816 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

The primary does not wait for an ack after releasing its backfill reservations, so a GRANT or REJECT_TOOFULL sent by a backfill target before it got the RELEASE can be processed several transitions later. In https://tracker.ceph.com/issues/77096 a REJECT_TOOFULL from the previous attempt arrived in WaitLocalBackfillReserved after a revoke made the primary retry, and the PG went to Crashed.

Of the four replies a backfill target can send (GRANT, REJECT_TOOFULL, REVOKE_TOOFULL, REVOKE), Active already discards the two revokes. GRANT and REJECT_TOOFULL were only discarded in NotBackfilling. WaitLocalBackfillReserved used to discard GRANT (#33525, https://tracker.ceph.com/issues/44248), but the custom_reaction was dropped from its reaction list in 899f7e6 (pool migration), leaving only an unused react(). Tentacle still has it.

This PR discards GRANT and REJECT_TOOFULL in Active, like the revokes, so any Active state that isn't waiting for them ignores them. WaitRemoteBackfillReserved and Backfilling keep their own handlers. The redundant NotBackfilling handlers and the unused WaitLocalBackfillReserved one are removed.

A stale GRANT that lands in a new WaitRemoteBackfillReserved is still counted as a reply to the new attempt; fixing that needs a RELEASE ack and is out of scope here.

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

Testing

New TestPeeringState case Issue77096: the primary is held in WaitLocalBackfillReserved (new mock flag inject_local_reservation_stall), gets a stale REJECT_TOOFULL and GRANT, then backfills (with a stale GRANT while Backfilling) and goes to active+clean.

Issue77096 unittest_peeringstate
without the fix aborts: bad state machine event in state 'Started/Primary/Active/WaitLocalBackfillReserved': ... RemoteReservationRejectedTooFull
with the fix passes 59/59 pass

Checklist

  • Tracker (select at least one)
    • References tracker ticket
  • Component impact
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • No doc update is appropriate
  • Tests (select at least one)
    • Includes unit test(s)
Show available Jenkins commands

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

The primary does not wait for an ack after it sends RELEASE for its
backfill reservations, so a GRANT or REJECT_TOOFULL that a backfill
target sent before it got the RELEASE can be processed after the
primary has moved on. Active already discards REVOKE_TOOFULL and
REVOKE for this reason, but GRANT and REJECT_TOOFULL are only
discarded in NotBackfilling. When one of them arrives in
WaitLocalBackfillReserved, for example after a revoke made the
primary retry, the PG enters Crashed:

  bad state machine event in state
  'Started/Primary/Active/WaitLocalBackfillReserved': ...
  RemoteReservationRejectedTooFull

WaitLocalBackfillReserved used to discard RemoteBackfillReserved
(https://tracker.ceph.com/issues/44248), but the custom_reaction was
dropped from its reaction list when pool migration was added in
899f7e6, leaving only the unused react().

Discard both events in Active, like the two revokes, so that every
Active state ignores them unless it is waiting for one. Remove the
now redundant handlers from NotBackfilling and the unused one from
WaitLocalBackfillReserved. Add a TestPeeringState case that delivers
stale replies in WaitLocalBackfillReserved and Backfilling.

Fixes: https://tracker.ceph.com/issues/77096
Signed-off-by: yulong Shi <[email protected]>
@github-actions

Copy link
Copy Markdown

Thank you for your contribution. Since you are not yet a member of the Ceph organization with write permissions on ceph/ceph.git, our CI will not automatically run. Any member of the Ceph organization may label this PR ci-approved to allow Jenkins CI jobs to run.

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.

1 participant