Repository navigation
Conversation
A metadata-only copy of an object onto itself (copy_itself) reads the source's manifest, then writes it back with keep_tail. The destination has its own RGWObjectCtx, so write_meta reads the head afresh and guards on whatever ID tag it finds then. An overwrite between the two steps replaces the head and sends the old tail to GC; the copy then writes that tail back into the head. GC deletes the tail the head names, and the overwrite's own tail leaks. A copy racing a delete does the same through write_meta's exclusive create. Add MetaParams::id_tag_guard, a cmpxattr on the ID tag the caller read, placed before prepare_atomic_modification() sets the new one, and skip the exclusive create for a guarded write. copy_obj guards a copy onto itself on the source's ID tag. A copy that fails the guard is answered as success, like any lost race. Fixes: https://tracker.ceph.com/issues/80900 Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Kyle Bader <[email protected]>
A copy of an object onto itself writes only over the head it read. When the head changed since, it was answered success without writing anything, like a lost race. That holds for a racing write, which replaced the object, but not for an attribute update: PutObjectTagging, PutObjectAcl and the other set_attrs callers give the head a new ID tag while they keep the object. The copy's new metadata was then lost, though the copy was answered success. Without the guard, as on main, the copy wrote back the tag set it read over the update's, or lost its own race the same way. Run the copy again from the head as it is now, up to twice, with the request's attributes, and answer 500 InternalError if it still loses. Reported in review by mheler. Tested on vstart: a copy onto itself with new metadata, held after it reads the head, and a PutObjectTagging or PutObjectAcl meanwhile. Without this change the copy is answered success and the object has no new metadata; with it the object carries both the copy's metadata and the update's tag set. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Kyle Bader <[email protected]>
5e94502 to
e7492df
Compare
|
@cbodley ok to merge? |
no, it needs regression testing in teuthology - hence the needs-qa label |
|
p.s. if you wrote test cases for this, they need to be part of this pr so they're included in qa validation |
|
This PR has been added to main integration testing by anuchaithra started 2026-10-06-07:40. |
|
@adamemerson @anrao19 i assume this needs tests from #72096 for validation, but that includes tests for lots of other prs too. how should we coordinate this testing? |
pr testing completed and approved by @ivancich, more details in https://tracker.ceph.com/issues/81454. |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
A metadata-only copy of an object onto itself (
copy_itself) reads the source's manifest, then writes it back withkeep_tail. The destination has its ownRGWObjectCtx, sowrite_metareads the head afresh and guards on whatever ID tag it finds then. An overwrite between the two steps replaces the head and sends the old tail to GC; the copy then writes that tail back into the head. GC deletes the tail the head names, and the overwrite's own tail leaks.Add
MetaParams::id_tag_guard, acmpxattron the ID tag the caller read, placed beforeprepare_atomic_modification()sets the new one, and skip the exclusive create for a guarded write, which would recreate a head deleted meanwhile.copy_objguards a copy onto itself on the source's ID tag. A copy that fails the guard is answered as success, like any lost race.The s3-test
test_object_copy_to_itself_racing_put(https://github.com/mmgaggle/s3-tests/tree/wip-rgw-overwrite-races), with the injection points in #72096, fails on main (GET stops after the head's 4 MiB, ENOENT on the tail) and passes with this change on a vstart cluster.Fixes: https://tracker.ceph.com/issues/80900
Versioned buckets and attribute updates
Attribute updates: PutObjectTagging, PutObjectAcl and the other
set_attrscallers give the head a new ID tag and keep the object. A copy onto itself that raced such an update failed its guard and was answered success without writing, so its new metadata was lost. A new commit makes a copy onto itself that loses its guard read the head again and retry, up to twice, and answer 500 InternalError if it still loses. Reported in review by @mheler.Versioned buckets: with versioning enabled, a copy onto the same key writes a new instance, so it is never a copy onto itself. With versioning suspended and another version current, the source resolves to that version and the copy takes references on its tail. With the null version current, the copy is a copy onto itself of the olh's head, and the guard applies.
Validated on vstart with the injection points of #72096:
test_copy_to_itself_racing_taggingandtest_copy_to_itself_racing_aclfail without the new commit and pass with it;test_suspended_copy_to_itselfandtest_suspended_copy_null_to_itselfpass. The P model (#72110) checks the tagging race on main, with this guard, and with the retry: only the retry holds.Checklist