Skip to content

rgw/multisite: validate the cached version on metadata sync reads - #71143

Open
SaravananPalanisamyRWTH wants to merge 7 commits into
ceph:mainfrom
SaravananPalanisamyRWTH:wip-77731-expected-version-reqstate
Open

SaravananPalanisamyRWTH wants to merge 7 commits into
ceph:mainfrom
SaravananPalanisamyRWTH:wip-77731-expected-version-reqstate

Conversation

@SaravananPalanisamyRWTH

@SaravananPalanisamyRWTH SaravananPalanisamyRWTH commented Aug 18, 2026 •

Copy link
Copy Markdown

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

If a distribute_cache() notification is lost, RGW gateways keep serving stale metadata until rgw_cache_expiry_interval. PR #69748 guards against a late cache update overwriting a newer one, but a dropped notification leaves no update to reject.

In multisite this leads to durable wrong metadata on the secondary, typically a 403 AccessDenied from an obsolete owner, while sync status reports no errors.

Every mdlog entry in secondary sync already contains the expected version of the metadata to be fetched from master. That version is now sent to the master as rgwx-expected-version-* params on the GET request, and the master answers from its cache only when the entry is at that version, otherwise reading from RADOS.

Fixed link_bucket(), which wrote the bucket entrypoint and its mdlog entry without a version (empty tag, ver 0). Both bucket link and bucket chown were affected, from the CLI and the admin REST API.

Known gaps: full sync does not rely on mdlog entry and hence no expected-version is sent. Account and group changes are never written to the mdlog.

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.

@github-actions

Copy link
Copy Markdown

Thank you for your contribution. Since you are not yet a member of the Ceph organization with write permissions on ceph/ceph.git, our CI will not automatically run. Any member of the Ceph organization may label this PR ci-approved to allow Jenkins CI jobs to run.

Comment thread src/rgw/rgw_common.h Resolved
Add an expected_version to sysobj reads. When it is set and the cached
entry is at a different version, the cache missed an update, so the
object is read from RADOS instead of being served from the cache.

rgw_get_system_obj() takes the expected_version and passes it down.

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

Signed-off-by: Saravanan Palanisamy <[email protected]>
Bucket entrypoint, bucket instance and user info reads take an
expected_version and pass it to the sysobj read.

binfo_cache sits ahead of the sysobj cache, so a bucket instance entry
that does not match the expected version is dropped and re-read.

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

Signed-off-by: Saravanan Palanisamy <[email protected]>
RGWMetadataManager::get() and every metadata handler's get() take an
optional expected_version and pass it to the read of their object.

The topic chained cache sits ahead of the sysobj cache, so a topic entry
that does not match the expected version is dropped and re-read. The
otp handler ignores it, since cls_otp reads do not use the sysobj cache.

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

Signed-off-by: Saravanan Palanisamy <[email protected]>
A system request may send optional rgwx-expected-version-tag and
rgwx-expected-version-ver on GET /admin/metadata.

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

Signed-off-by: Saravanan Palanisamy <[email protected]>
If distribute_cache() drops the notification, the primary's
other RGW daemons keep serving an entry older than RADOS for up to
rgw_cache_expiry_interval, and a secondary syncing that entry replicates
the stale version. It shows up as 403 AccessDenied on the secondary from
an obsolete owner or ACL, with a clean sync status.

Send the version from the mdlog entry with the metadata GET, so the
primary re-reads from RADOS when its cached copy is not at that version.
Full sync sends does not send expected_version

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

Signed-off-by: Saravanan Palanisamy <[email protected]>
RGWBucketCtl::link_bucket() calls store_bucket_entrypoint_info() to
store the bucket entrypoint object in cache and mdlog entry.

The link_bucket() callers (RadosBucket::link() and
RRGWBucketAdminOp::link()) construct bucket entrypoint object without
object version. link_bucket() does not read the stored version either.
Hence the cache and mdlog entry carries empty tag and version 0.

Read the stored entrypoint when ep_objv has no version.

Signed-off-by: Saravanan Palanisamy <[email protected]>
} else {
/* store_bucket_entrypoint_info() below needs the current version, or
* the correspoding mdlog entry has an empty tag and zero version */
if (!pinfo || rot.read_version.tag.empty()) {

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.

now that we will be reading the entrypoint whenever ep_objv is empty, this entrypoint read uses the sysobj cache. on PUT /admin/bucket the radosgw may already hold a stale entry from a missed distribute_cache(), so the store could check the old version and return -ECANCELED. the test written in the PR may not exercise this because radosgw-admin starts with an empty cache, unlike the admin rest api. maybe this read could skip the cache, so -ECANCELED means an actual concurrent link?

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.

> maybe this read could skip the cache, so -ECANCELED means an actual concurrent link?

hmm even if this read skips the cache, a writer can still commit between the read and store_bucket_entrypoint_info and bump the rados version. basically, if that read_bucket_entrypoint_info leaves a stale version in rot or that race, could make store_bucket_entrypoint_info below return -ECANCELED due to version mismatch while RGWBucketAdminOp::link() would have already unlinked the bucket from the old owner and moved the instance to the new owner. done_err would then remove the new owner too, before link() sees -ECANCELED, leading to inconsistent ownership.

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.

the purpose is to give mdlog entry a version. how about we just generate one with generate_new_write_ver() on a local tracker? it gives the store_bucket_entrypoint_info and the mdlog a version without the read.

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.

3 participants