Repository navigation
rgw: guard a delete's head removal on the ID tag it read - #72945
AliMasarweh wants to merge 5 commits into
Conversation
d4ed856 to
706a98f
Compare
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]>
Signed-off-by: Ali Masarwa <[email protected]>
Signed-off-by: Ali Masarwa <[email protected]>
706a98f to
4592506
Compare
|
Passing teuthology run https://pulpito-ng.ceph.com/runs/alimasarwa-2026-11-05_17:41:44-rgw-wip-alimasa-del-idtag-guard-distro-default-trial (I think that the failures are not related to my change) |
| return; | ||
| } | ||
| // send request to notification manager | ||
| auto ret = res->publish_commit(this, s->obj_size, mtime, etag, s->object->get_instance()); |
There was a problem hiding this comment.
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();
}
| } | ||
|
|
||
| // send request to notification manager | ||
| ret = res->publish_commit(this, obj_size, mtime, etag, s->object->get_instance()); |
There was a problem hiding this comment.
nit: Same as PutObject - notification gets sent even object is not written for cancelled unconditional copy .
Ceph PR triage — related open PRsQueried #72945 against KB snapshot
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: |
|
@AliMasarweh Thank you for reviewing this pull request! As a member of the Ceph organization, please add yourself to |
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
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.