Skip to content

RGW | fix conditional Delete, MultiDelete and Put - #63348

Merged
AliMasarweh merged 2 commits into
ceph:mainfrom
AliMasarweh:wip-alimasa-68183
Jul 28, 2025
Merged

AliMasarweh merged 2 commits into
ceph:mainfrom
AliMasarweh:wip-alimasa-68183

Conversation

@AliMasarweh

Copy link
Copy Markdown
Member

https://tracker.ceph.com/issues/68183
https://bugzilla.redhat.com/show_bug.cgi?id=2350732

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

@AliMasarweh
AliMasarweh requested a review from a team as a code owner May 19, 2025 12:15
@github-actions github-actions Bot added the rgw label May 19, 2025
@cbodley

cbodley commented May 19, 2025

Copy link
Copy Markdown
Contributor

looking for IfMatch/IfNoneMatch in s3-tests, i only see test cases for get_object() which wouldn't call through prepare_atomic_modification()

could you please add test cases for put_object() and complete_multipart_upload() that covers both etag values and the * wildcard?

@AliMasarweh

Copy link
Copy Markdown
Member Author

looking for IfMatch/IfNoneMatch in s3-tests, i only see test cases for get_object() which wouldn't call through prepare_atomic_modification()

could you please add test cases for put_object() and complete_multipart_upload() that covers both etag values and the * wildcard?

sure, @mattbenjamin said that there are more cases that need fix such as:
multidelete and multiput looking for a LastModified
I will do that then write the tests

@AliMasarweh AliMasarweh changed the title RGW: conditional write fix for if-match={etag} RGW: conditional write fix for if-match and if-match-last-modified-time May 22, 2025
Comment thread src/rgw/rgw_rest.cc Resolved
@AliMasarweh AliMasarweh changed the title RGW: conditional write fix for if-match and if-match-last-modified-time RGW | fix conditional write for If-Match and If-Unmodified-Since Jun 1, 2025
@AliMasarweh
AliMasarweh force-pushed the wip-alimasa-68183 branch 2 times, most recently from e24ca5a to 9d3a326 Compare June 4, 2025 13:53
@github-actions github-actions Bot added the tests label Jun 4, 2025
@AliMasarweh AliMasarweh changed the title RGW | fix conditional write for If-Match and If-Unmodified-Since RGW | fix conditional write for If-Match and If-Match-Last-Modified-Time Jun 4, 2025
Comment thread src/include/utime.h Resolved
Comment thread src/rgw/driver/rados/rgw_rados.cc Resolved
@AliMasarweh
AliMasarweh force-pushed the wip-alimasa-68183 branch 3 times, most recently from 6234330 to 0627bf2 Compare June 10, 2025 09:36
Comment thread src/rgw/rgw_rest_s3.cc Resolved
@AliMasarweh
AliMasarweh force-pushed the wip-alimasa-68183 branch 3 times, most recently from 02498a1 to 186325b Compare June 11, 2025 11:10
Comment thread src/rgw/rgw_op.h Resolved
Comment thread src/rgw/rgw_multi_del.h Resolved
Comment thread src/rgw/rgw_multi_del.cc Resolved
@AliMasarweh

Copy link
Copy Markdown
Member Author

I think the issue in conditional put with versioned bucket, is this block of code in RGWRados::get_obj_state_impl:

  if (s->has_attrs) {
    if (s->is_olh && need_follow_olh) {
      return get_olh_target_state(dpp, *octx, bucket_info, obj, s, psm, y);
    }
    return 0;
  }

we return from this function and the object doesn't have an etag in attrs

why are we expecting an attrs here?

@dang

dang commented Jun 18, 2025

Copy link
Copy Markdown
Contributor

I think the issue is that there are two objects in question here. The unversioned object, and the versioned object. That sequence you posted does load the state (and so the attributes) of the versioned object, but it doesn't do anything to the unversioned object. Where is this being called from?

@mattbenjamin

Copy link
Copy Markdown
Contributor

the subject says "fix conditional write" but is this PR going to address DeleteObject only?

@cbodley

cbodley commented Jun 18, 2025 •

Copy link
Copy Markdown
Contributor

I think the issue in conditional put with versioned bucket, is this block of code in RGWRados::get_obj_state_impl:

#60957 reported a similar issue here, but the fix wasn't passing tests :(

edit: i think that was specific to multipart uploads though

@cbodley

cbodley commented Jun 18, 2025 •

Copy link
Copy Markdown
Contributor

I think the issue in conditional put with versioned bucket, is this block of code in RGWRados::get_obj_state_impl:

@AliMasarweh what are you expecting conditional put to do in a versioned bucket? with versioning enabled, writes create a new object version instead of overwriting an existing one. so If-Match would not find an existing etag for comparison

edit: maybe i'm mistaken, https://docs.aws.amazon.com/AmazonS3/latest/userguide/conditional-writes.html#conditional-error-response talks about interactions with versioning enabled/suspended

@AliMasarweh AliMasarweh changed the title RGW | fix conditional write for If-Match and If-Match-Last-Modified-Time RGW | fix conditional Delete, MultiDelete and Put Jun 19, 2025
@AliMasarweh
AliMasarweh requested a review from a team as a code owner July 21, 2025 14:28
@github-actions github-actions Bot added the rbd label Jul 21, 2025
size_match supports size 0
checks_preconditions checks for last_modified and size as well
supports versioned object

Signed-off-by: Ali Masarwa <[email protected]>
@idryomov idryomov removed the rbd label Jul 21, 2025
@idryomov
idryomov removed the request for review from a team July 21, 2025 15:23
@AliMasarweh

Copy link
Copy Markdown
Member Author

do we have a stable commit on main that I should rebase on my code, teuthology has too many valgrind error:
https://pulpito.ceph.com/alimasa-2025-07-21_14:44:30-rgw-wip-alimasa-68183-distro-default-smithi/

@mattbenjamin
mattbenjamin self-requested a review July 23, 2025 17:48

@mattbenjamin mattbenjamin left a comment

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.

appreciate the cleanup, new change backported with only the async dispatch conflict, seems to have passed downstream QA; thank you!

@kayrus

kayrus commented Jul 23, 2025 •

Copy link
Copy Markdown

qa/rgw/s3tests-branch.yaml modification should be cleaned up as well
#63348 (comment)

Comment thread src/rgw/driver/rados/rgw_rados.cc Resolved
Comment thread src/rgw/driver/rados/rgw_rados.cc Resolved
@AliMasarweh

Copy link
Copy Markdown
Member Author

jenkins test make check arm64

@ivancich

ivancich commented Aug 11, 2025 •

Copy link
Copy Markdown
Member

This PR appears to have caused some significant breakage:

A new error regarding orphan list showed up during the teuthology run that indicated a regression:

https://pulpito.ceph.com/alimasa-2025-07-28_14:08:21-rgw-wip-alimasa-68183-distro-default-smithi/8412051

I bisected the orphan list failure to commit 55f5b76 , which is one of the two commits in this PR.

@AliMasarweh AliMasarweh mentioned this pull request Sep 17, 2025
4 of 14 tasks
@cupnes

cupnes commented Sep 17, 2025

Copy link
Copy Markdown

Do you have any plans to backport this to squid?

@ivancich

Copy link
Copy Markdown
Member

Do you have any plans to backport this to squid?

The tracker does not list any backports, and we try to record backports there. But @AliMasarweh may know differently....

@cbodley

cbodley commented Sep 17, 2025

Copy link
Copy Markdown
Contributor

Do you have any plans to backport this to squid?

thanks @cupnes, i updated https://tracker.ceph.com/issues/68183 to request squid and tentacle backports

@cupnes

cupnes commented Sep 18, 2025

Copy link
Copy Markdown

@ivancich @cbodley
I understood. Thank you!

jbreemhaar added a commit to stackpadeu/certmagic-s3 that referenced this pull request Aug 15, 2026
The previous commit explained the ETag stripping in terms of one vendor's
storage, which reads like a local workaround. It is the opposite, and the
comment now carries the citations to show it.

The quoted form is the one that is not portable. Ceph compared the raw
If-Match header against the stored tag without unquoting it first, fixed in
ceph/ceph#63348 (merged to main 2025-07-28). The tentacle backport
ceph/ceph#65949 merged 2026-02-19, after v20.2.0 was cut, and the squid
backport ceph/ceph#65932 is still open, so every v19.x and v20.2.0 deployment
refuses a quoted conditional write today. The unquoted form works on those,
works on the fixed releases, and works on MinIO, SeaweedFS and versitygw,
which compare with the quotes off on both sides. Stripping also stays correct
once the fix is everywhere, because taking the quotes off a bare tag does
nothing, so this does not become dead weight later.

The strongest argument is that Ceph's own compliance suite agrees: s3-tests
strips the quotes before setting If-Match on PutObject in
test_put_object_ifmatch_good. Their newer test_put_object_if_match passes the
quoted tag straight through, so once the fix has landed both spellings are
expected to work and only one of them works before it.

How sure we are, stated plainly, because it is not all the same strength.
Measured first hand: everything in the table in the comment, against Hetzner
Object Storage, including the control line showing a wrong tag is still
refused. Verified from source: the Ceph pull requests and their merge state,
and the s3-tests assertions. Strong but not a documented guarantee: that
Amazon S3 accepts the unquoted form. AWS documents and demonstrates the
quoted form, and nowhere promises to take a bare tag; the evidence that it
does is that terraform-provider-aws sends stripped ETags as If-Match against
real AWS at scale, plus an unquoted value in AWS's own CLI example. Nobody
here has an Amazon account to close that last gap. If takeovers ever stop
working against Amazon, this function is the first place to look.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GduFdCXxotpmtrncHrMTup
@xmb2

xmb2 commented Nov 16, 2026 •

Copy link
Copy Markdown

@AliMasarweh @cbodley After this change, delete_obj() no longer adds the cmpxattr(RGW_ATTR_ID_TAG) guard, so a conditional DeleteObject can remove an object that was overwritten after the precondition check. Was it intentional?

We are testing Ceph RGW for ClickHouse content-addressed storage (Altinity Antalya builds) and this is one of roadblocks along with unconditional PutObject while DeleteObject on the same key runs (but another issues were fixed by this pull request, thank you!).

@AliMasarweh

Copy link
Copy Markdown
Member Author

@AliMasarweh @cbodley After this change, delete_obj() no longer adds the cmpxattr(RGW_ATTR_ID_TAG) guard, so a conditional DeleteObject can remove an object that was overwritten after the precondition check. Was it intentional?

We are testing Ceph RGW for ClickHouse content-addressed storage (Altinity Antalya builds) and this is one of roadblocks along with unconditional PutObject while DeleteObject on the same key runs (but another issues were fixed by this pull request, thank you!).

No it wasn't intentional, it should be fixed in an ongoing PR

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.

10 participants