Skip to content

rgw: guard a delete's head removal on the ID tag it read - #72945

Open
AliMasarweh wants to merge 5 commits into
ceph:mainfrom
AliMasarweh:wip-alimasa-del-idtag-guard
Open

AliMasarweh wants to merge 5 commits into
ceph:mainfrom
AliMasarweh:wip-alimasa-del-idtag-guard

Conversation

@AliMasarweh

@AliMasarweh AliMasarweh commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Continuation to PR #72100

55f5b76 ("fix conditional Delete and MultiDelete") replaced the delete's call to prepare_atomic_modification(removal_op=true), which added a cmpxattr on the ID tag, with check_preconditions, which adds nothing to the op. A delete that races an overwrite now removes the new head, then sends the manifest it read, the old one, to GC. The new object's tail, or a completion's parts, is never collected.

Guard the removal with append_atomic_test again. DeleteObject already answers the lost race's -ECANCELED with success; answer it the same way in multi-object delete, which reported it as an error before 55f5b76 as well.

The workunit case test_delete_racing_put in #72096 fails on main (the PutObject's tail remains after GC) and passes with this change on a vstart cluster.

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

With the removal guarded, a delete can lose the race to a write that replaced the head. DeleteObject answers that with success, which is right for an unconditional delete. A conditional one (If-Match, If-Match-Size, If-Match-Last-Modified-Time, If-Unmodified-Since) cannot claim its condition held, so the second commit answers its lost race with 409 ConditionalRequestConflict, in DeleteObject and in multi-object delete, and adds that error (https://tracker.ceph.com/issues/80906). The guard also closes a conditional delete deleting an object that fails its If-Match; the workunit case test_cond_delete_racing_put in #72096 fails on main and passes with this change.

Versioned buckets
In a bucket whose versioning is suspended, a DeleteObject of the null version logs the removal of the null instance, and whoever applies the olh log removes its head. If a PutObject wrote the key's head and linked a new null version in between, that removal took the new version's head: the version stayed current and lost its data. A new commit makes apply_olh_log cancel a pending removal when a later entry links the same instance as a version, with "null" and the empty instance treated as the same key.

Validated on vstart with the injection points of #72096: the workunit case test_suspended_delete_null_racing_put fails without the new commit and passes with it.

Not covered here:

when the guarded removal inside apply_olh_log loses a race, the error is treated as a race with another applier, and the rewritten head stays until the log is applied again;
a conditional DeleteObject with versionId=null checks its condition apart from the unlink, which needs a cls condition on unlink_instance, like the one #72118 adds to link_olh.

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.

@AliMasarweh
AliMasarweh requested a review from a team as a code owner October 21, 2026 14:15
@github-actions github-actions Bot added the rgw label Oct 21, 2026
@AliMasarweh
AliMasarweh force-pushed the wip-alimasa-del-idtag-guard branch 2 times, most recently from d4ed856 to 706a98f Compare November 5, 2026 14:55
mmgaggle and others added 5 commits November 5, 2026 17:31
55f5b76 ("fix conditional Delete and MultiDelete") replaced the
delete's call to prepare_atomic_modification(removal_op=true), which
added a cmpxattr on the ID tag, with check_preconditions, which adds
nothing to the op. A delete that races an overwrite now removes the new
head, then sends the manifest it read, the old one, to GC. The new
object's tail, or a completion's parts, is never collected.

Guard the removal with append_atomic_test again. DeleteObject already
answers the -ECANCELED of a lost race with success; answer it the same
way in multi-object delete, which reported it as an error before
55f5b76 as well.

Fixes: https://tracker.ceph.com/issues/80898
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Kyle Bader <[email protected]>
With the removal guarded on the ID tag it read, a delete can now lose
the race to a write that replaced the head, and gets -ECANCELED.
DeleteObject answers that with success, and so does multi-object delete
since the previous commit. That is right for an unconditional delete,
which counts as ordered before the write. A conditional one (If-Match,
If-Match-Size, If-Match-Last-Modified-Time, If-Unmodified-Since) cannot
claim its condition held: ordered before the write, its condition was
checked against a head that is gone, and ordered after it, the
condition was never checked against the new head.

Answer a conditional delete's lost race with 409
ConditionalRequestConflict, as S3 does for a conditional request that
loses to a concurrent operation, and add that error.

Fixes: https://tracker.ceph.com/issues/80906
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Kyle Bader <[email protected]>
In a bucket whose versioning is suspended, a DeleteObject of the null
version unlinks it, which logs the removal of the null instance on the
olh, and removes its head when the log is applied. The null version's
head is the key's olh head object, which a PutObject of a new null
version writes too. When that PutObject wrote the head and linked its
version after the removal was logged, but before the log was applied,
whoever applied the log, the PutObject itself or the delete, still
removed the null instance's head. The new version stayed current and
lost its data. The ID-tag guard on the removal does not help, as the
removal reads the head afresh.

apply_olh_log already cancels an instance's removal when the instance is
linked again after an unlink of the olh. Cancel it whenever a later entry
links the same instance as a version, as a new null version does. The
unlink logs the null instance as "null", the write as the empty
instance: treat them as the same. A null delete marker linked afterwards
still leaves the removal in place.

Tested on vstart: a DeleteObject of the null version held after its
unlink, and a PutObject that writes and links meanwhile. Without this
change the PutObject's version is current but its head has no object;
with it the object reads back whole.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Kyle Bader <[email protected]>
@AliMasarweh
AliMasarweh force-pushed the wip-alimasa-del-idtag-guard branch from 706a98f to 4592506 Compare November 5, 2026 15:31
@AliMasarweh

Copy link
Copy Markdown
Member Author

Comment thread src/rgw/driver/rados/rgw_rados.cc Resolved
Comment thread src/rgw/driver/rados/rgw_rados.cc Resolved
Comment thread src/rgw/rgw_op.cc
return;
}
// send request to notification manager
auto ret = res->publish_commit(this, s->obj_size, mtime, etag, s->object->get_instance());

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.

nit: In case of unconditional writes, -ECANCELED gets mapped to '0' (op_ret) and this notification will be sent incorrectly.

if (!dst_cancelled) { ..
res->publish_commit();
}

Comment thread src/rgw/rgw_op.cc
}

// send request to notification manager
ret = res->publish_commit(this, obj_size, mtime, etag, s->object->get_instance());

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.

nit: Same as PutObject - notification gets sent even object is not written for cancelled unconditional copy .

Comment thread src/rgw/rgw_op.cc Resolved
@RaminNietzsche

RaminNietzsche commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Ceph PR triage — related open PRs

Queried #72945 against KB snapshot 2026-11-10T06:02:21 in 1.1s.
Signals are candidates for human review, not merge blockers.

Category Confidence Other PR(s) Note
shares-commits low #72109 2 identical commits in both (shared base work or cherry-picks); text sim 0.616; file Jaccard 0.8; 6 overlapping hunks; same tracker 80898,80906; 2 identical com

This comment is updated in place when the workflow re-runs (hidden HTML marker). Data: read-only GitHub + local git analysis; no labels or merges were changed.

@AliMasarweh

Copy link
Copy Markdown
Member Author

Ceph PR triage — related open PRs

Queried #72945 against KB snapshot 2026-11-10T06:02:21 in 1.1s. Signals are candidates for human review, not merge blockers.

Category Confidence Other PR(s) Note
shares-commits low #72109 2 identical commits in both (shared base work or cherry-picks); text sim 0.616; file Jaccard 0.8; 6 overlapping hunks; same tracker 80898,80906; 2 identical com
This comment is updated in place when the workflow re-runs (hidden HTML marker). Data: read-only GitHub + local git analysis; no labels or merges were changed.

in #72945 description:

Depends on #72100; the first two commits are #72100.

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown

@AliMasarweh Thank you for reviewing this pull request! As a member of the Ceph organization, please add yourself to .githubmap in the main branch if you haven't already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants