Skip to content

rgw: avoid doubled ARN in GetBucketReplication for pre-existing data - #68137

Merged
cbodley merged 1 commit into
ceph:mainfrom
lumir-sliva:fix/rgw-replication-duplicate-arn
May 19, 2026
Merged

cbodley merged 1 commit into
ceph:mainfrom
lumir-sliva:fix/rgw-replication-duplicate-arn

Conversation

@lumir-sliva

@lumir-sliva lumir-sliva commented Mar 31, 2026 •

Copy link
Copy Markdown
Contributor

Before commit b8f8932 ("rgw: handle destination bucket as an ARN
in ReplicationConfiguration"), PutBucketReplication stored the full
ARN string (e.g. arn:aws:s3:::bucket) as the bucket name in the sync
policy. After that commit, GetBucketReplication wraps the stored
bucket name in a new ARN via ARN(rgw_bucket).to_string(), which
produces a doubled prefix like arn:aws:s3:::arn:aws:s3:::bucket for
buckets whose replication was configured before the fix.

This makes the GET-then-PUT workflow impossible — the doubled ARN is
rejected as invalid input on subsequent PUT requests.

The fix detects whether the stored bucket name is already a valid S3
ARN and uses it directly, avoiding the double-wrapping. New data
written after b8f8932 stores only the bare bucket name, so the
else branch handles that case unchanged.

How to reproduce

  1. On a squid (or older) cluster, set up a realm with endpoints and
    a zonegroup-level sync group so the S3 Replication API is enabled.
  2. Create two buckets, enable versioning on the source, and call
    PutBucketReplication with destination arn:aws:s3:::dest-bucket.
  3. Verify the sync policy stores the full ARN as the bucket name:
    radosgw-admin metadata get bucket.instance:<source>:<id>
    
    shows dest.bucket = "arn:aws:s3:::dest-bucket" in sync_policy.
  4. Upgrade to tentacle/main (which includes b8f8932).
  5. Call GetBucketReplication — the destination bucket ARN is now
    arn:aws:s3:::arn:aws:s3:::dest-bucket.

Verified on a squid 19.2.2 cluster.

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

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)

Before commit b8f8932 ("rgw: handle destination bucket as an ARN
in ReplicationConfiguration"), the PutBucketReplication handler stored
the full ARN string (e.g. "arn:aws:s3:::bucket") as the bucket name
in the sync policy.  After that commit, the GetBucketReplication
handler wraps the stored bucket name in a new ARN via
ARN(rgw_bucket).to_string(), which produces a doubled prefix like
"arn:aws:s3:::arn:aws:s3:::bucket" for buckets whose replication was
configured before the fix.

Detect whether the stored bucket name is already a valid S3 ARN and
use it directly instead of wrapping it again.  New data written after
b8f8932 stores only the bare bucket name, so the else branch
handles that case unchanged.

Fixes: https://tracker.ceph.com/issues/75770
Signed-off-by: Lumir Sliva <[email protected]>
@lumir-sliva
lumir-sliva requested a review from a team as a code owner March 31, 2026 15:05
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok to test" to allow the Jenkins jobs to run.

13 similar comments
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok to test" to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok to test" to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok to test" to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok to test" to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok to test" to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok to test" to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok to test" to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok to test" to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok to test" to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok to test" to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok to test" to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok to test" to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok to test" to allow the Jenkins jobs to run.

@github-actions github-actions Bot added the rgw label Mar 31, 2026
@cbodley
cbodley requested a review from clwluvw April 1, 2026 20:00
@cbodley cbodley added the bug-fix label Apr 1, 2026
@benaryorg

benaryorg commented Apr 2, 2026 •

Copy link
Copy Markdown
Contributor

I can confirm that this fixes the issue (this PR cherry-picked on top of v20.2.0, including several other patches).

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@clwluvw

clwluvw commented Apr 3, 2026

Copy link
Copy Markdown
Member

I'm trying to find whether this is the only effect and not affecting matching and bucket loading. Was your testing successful with all syncs and permission checks?

@benaryorg

Copy link
Copy Markdown
Contributor

Was your testing successful with all syncs and permission checks?

I'm afraid I'm not entirely the right person to ask that question.
For getting multi-site sync running I still depend on reverting some prior changes, however the replication itself so far seems unaffected.

In terms of permission checks any access from IAM subkeys does work correctly, and unauthenticated access is denied, however I haven't tested beyond that (i.e. no authenticated access from credentials without permission or testing for permissions other than GET/PUT basically).

Note that all of those tests of mine were very much on the surface of a cluster running in production, so while the results are authentic, I didn't get any debug output for the respective requests or such.

@lumir-sliva

Copy link
Copy Markdown
Contributor Author

I'm trying to find whether this is the only effect and not affecting matching and bucket loading. Was your testing successful with all syncs and permission checks?

The change is scoped entirely to the GetBucketReplication XML serialization path — specifically where we build the <Destination><Bucket> element in the response. It doesn't touch PutBucketReplication, the sync engine's pipe resolution, or how pipe.dest.bucket is stored/loaded. The sync engine reads from rgw_sync_policy_info structures directly, not from the XML output.

What the fix does: before serializing, it checks whether pipe.dest.bucket->name is already a valid S3 ARN (from data written before b8f8932). If so, it uses it as-is instead of wrapping it in another ARN(). The else branch for new data is unchanged.

For additional confidence, I can add a round-trip integration test along the lines of the existing test_bucket_replication_basic_object_sync:

  1. PutBucketReplication → GetBucketReplication → assert the returned destination ARN is exactly arn:aws:s3:::<bucket> (not doubled)
  2. Same as above but with old-format data injected via radosgw-admin to simulate pre-b8f89327e1a buckets
  3. Verify sync still works after the round-trip (object written to source appears in dest)

Happy to add those if it would help move this forward.

@anrao19

anrao19 commented May 12, 2026

Copy link
Copy Markdown
Contributor

@anrao19

anrao19 commented May 18, 2026

Copy link
Copy Markdown
Contributor

pr testing is in progress .. https://tracker.ceph.com/issues/76520

pr testing completed : https://tracker.ceph.com/issues/76520 , and approved by @ivancich.
@lumir-sliva , if no further testing is needed then this pr can be merged

@anrao19

anrao19 commented May 18, 2026

Copy link
Copy Markdown
Contributor

jenkins test dashboard

@anrao19

anrao19 commented May 18, 2026

Copy link
Copy Markdown
Contributor

jenkins test dashboard cephadm

@anrao19

anrao19 commented May 18, 2026

Copy link
Copy Markdown
Contributor

jenkins test rook e2e

@cbodley
cbodley merged commit a730478 into ceph:main May 19, 2026
10 checks passed
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.

6 participants