Skip to content

rgw: re-link an index entry whose pending op expired - #72102

Open
mmgaggle wants to merge 1 commit into
ceph:mainfrom
mmgaggle:wip-rgw-relink-expired-entry
Open

mmgaggle wants to merge 1 commit into
ceph:mainfrom
mmgaggle:wip-rgw-relink-expired-entry

Conversation

@mmgaggle

@mmgaggle mmgaggle commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

A bucket listing drops a pending index op older than rgw_pending_bucket_index_op_expiration and repairs the entry from the head it reads. If a write stalled past the expiry before its head write, the listing repairs the entry from the old head, or removes it for a new key. The write then writes its head, and its index completion fails with -EINVAL because its tag is gone; the completion is asynchronous and the error is dropped, so the index keeps listing the old object, or nothing.

When a completion comes back -EINVAL, run a fresh index transaction for the key in the completion manager's thread: prepare a new pending op, read the head, and complete from the head as it is now, with its epoch. A delete whose head is still gone completes with its own epoch, and anything else cancels; remove_objs go along either way. A racing write or delete either sees the new pending op or is ordered by epoch, as for any write. Applying the late completion in cls_rgw when its epoch is newer would not do: an entry a delete has removed keeps no epoch, so it would bring the deleted object back.

Also factor the head-to-entry conversion out of check_disk_state into head_dir_meta() for the re-link to share.

The s3-test test_listing_during_stalled_put (https://github.com/mmgaggle/s3-tests/tree/wip-rgw-overwrite-races), which holds a PutObject past a short pending-op expiry with the injection points in #72096, fails on main and passes with this change on a vstart cluster. The design was checked with a formal model (https://github.com/mmgaggle/ceph/tree/cdbbbb09245535782e91503ad45b0cc7a423e10d/src/test/formal/p/rgw_overwrite) in listing scenarios with writers that stall, including a new key's first write and a racing delete.

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

Versioned buckets

A versioned write's pending op sits on the version's instance entry, or for a null version over a key with an olh, on the null instance entry behind the key's version marker. Neither ListObjects nor ListObjectVersions repairs those entries, so the loss this PR fixes does not occur there, and the re-link does not run for them. Validated on vstart with workunit cases that list a bucket during a stalled PutObject, with versioning enabled and suspended.

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)

A bucket listing drops a pending index op that is older than
rgw_pending_bucket_index_op_expiration, and repairs the entry from the
head it reads. If a write stalled past the expiry before its head
write, the listing repairs the entry from the old head, or removes it
for a new key. The write then writes its head, and its index completion
fails with -EINVAL because its tag is gone. The completion is
asynchronous and the error is dropped, so the index keeps listing the
old object, or nothing.

When a completion comes back -EINVAL, run a fresh index transaction for
the key in the completion manager's thread: prepare a new pending op,
read the head, and complete from the head as it is now, with its epoch;
a delete whose head is still gone completes with its own epoch, and
anything else cancels. remove_objs go along either way. A racing write
or delete either sees the new pending op or is ordered by epoch, as for
any write. Applying the late completion in cls_rgw when its epoch is
newer would not do: an entry a delete has removed keeps no epoch, so it
would bring the deleted object back.

Factor the head-to-entry conversion out of check_disk_state into
head_dir_meta() for the re-link to share.

Fixes: https://tracker.ceph.com/issues/80903
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Kyle Bader <[email protected]>
@github-actions github-actions Bot added the rgw label Sep 26, 2026
@mmgaggle
mmgaggle marked this pull request as ready for review September 26, 2026 08:00
@mmgaggle
mmgaggle requested a review from a team as a code owner September 26, 2026 08:00
@adamemerson adamemerson self-assigned this Sep 30, 2026
@adamemerson adamemerson removed their assignment Nov 18, 2026
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.

3 participants