Skip to content

tentacle: rgw/lc: report x-amz-expiration only for the current version - #70494

Merged
batrick merged 1 commit into
ceph:tentaclefrom
lumir-sliva:rgw-lc-expiration-header-current-version-tentacle
Aug 20, 2026
Merged

batrick merged 1 commit into
ceph:tentaclefrom
lumir-sliva:rgw-lc-expiration-header-current-version-tentacle

Conversation

@lumir-sliva

@lumir-sliva lumir-sliva commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #69642 to tentacle.

The x-amz-expiration response header describes the current-version
Expiration lifecycle action for an object. s3_expiration_header() instead
selected between the Expiration and NoncurrentVersionExpiration rule based
on whether the resolved object key carried an instance id, so a plain
GET/HEAD of the current version (whose instance id is filled in by OLH
resolution) was misclassified as a non-current request and surfaced a
NoncurrentVersionExpiration rule that x-amz-expiration should never report.

This computes the header from the current-version Expiration rule only,
returns no header for a request targeting a specific versionId, and passes
the client request key rather than the OLH-resolved key.

Backport note (deviation from a clean cherry-pick, see the Conflicts: block
in the commit): main passes s->object_key, which was added by f9cf6f6
and is not present on this branch. The equivalent client request key is built
inline as rgw_obj_key(s->object->get_key().name, s->info.args.get("versionId"))
instead. Functionally identical: object name plus the requested versionId
(empty for a plain request).

Tracker: https://tracker.ceph.com/issues/78567

Checklist

  • Tracker (select at least one)
    • References tracker ticket
  • Component impact
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • No doc update is appropriate
  • Tests (select at least one)
    • Includes unit test(s)

@lumir-sliva
lumir-sliva requested a review from a team as a code owner July 23, 2026 17:42
@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.

16 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" (without the dashes) 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" (without the dashes) 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" (without the dashes) 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" (without the dashes) 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" (without the dashes) 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" (without the dashes) 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" (without the dashes) 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" (without the dashes) 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" (without the dashes) 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" (without the dashes) 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" (without the dashes) 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" (without the dashes) 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" (without the dashes) 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" (without the dashes) 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" (without the dashes) 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" (without the dashes) to allow the Jenkins jobs to run.

@github-actions github-actions Bot added this to the tentacle milestone Jul 23, 2026
@github-actions github-actions Bot added the releng-audit-pass Release engineering: passed backport verification audit. label Jul 23, 2026
@adamemerson

Copy link
Copy Markdown
Contributor

ok to test

@anrao19

anrao19 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@anrao19

anrao19 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

The x-amz-expiration response header describes the current-version
Expiration lifecycle action for an object. s3_expiration_header() instead
selected between the Expiration and the NoncurrentVersionExpiration rule
based on whether the object key carried an instance id:

  const LCExpiration& rule_expiration =
    (obj_key.instance.empty()) ? expiration : noncur_expiration;

This was wrong in two ways. OLH resolution writes the current version's
instance id into the key before the header is computed, so even a plain
GET/HEAD of the current version (no versionId) was treated as a
non-current request and reported a NoncurrentVersionExpiration rule. And
x-amz-expiration is not meant to surface NoncurrentVersionExpiration at
all. A versioned bucket whose only rule was NoncurrentVersionExpiration
therefore returned a bogus expiry-date and rule-id on the current object,
for both a plain request and a versionId request.

Compute the header from the current-version Expiration rule only, and
return no header when the request targets a specific version. The header
helper now passes the client request key (s->object_key) rather than the
OLH-resolved key, so a plain GET/HEAD of the current version is no longer
misclassified as a versioned request.

Add a unit test covering a noncurrent-only policy (no header for either a
plain or a versioned request) and a combined policy (the current
Expiration rule for the current version, no header for a versionId
request).

Tracker: https://tracker.ceph.com/issues/77564
Reported-by: Saravanan Palanisamy
Signed-off-by: Lumir Sliva <[email protected]>
(cherry picked from commit 960b330)

Conflicts:
	src/rgw/rgw_rest_s3.cc: req_state::object_key does not exist on
	this branch (added by f9cf6f6, not backported). Build the
	equivalent client request key from the object name plus the
	requested versionId inline instead.
@lumir-sliva
lumir-sliva force-pushed the rgw-lc-expiration-header-current-version-tentacle branch from d174c70 to 30daa12 Compare July 24, 2026 11:47
@github-actions github-actions Bot removed the releng-audit-pass Release engineering: passed backport verification audit. label Jul 24, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ceph Release Engineering Audit Report

Commit Parity Visualizer

BACKPORT PR #70494 SOURCE PR SOURCE STATUS
30daa12 rgw/lc: report x-amz-expiration only for the current version PR #69642 960b330 rgw/lc: report x-amz-expiration only for the current version

Automated Backport Parity Review - Cherry-Pick Conflicts / Deviations

⚠️ WARNING: Cherry-pick conflicts or deviations were found that require component lead review.

A conflict or deviation was detected during the simulation of this backport. The code in this PR does not match a clean cherry-pick of the upstream commits.

This does not necessarily indicate an issue but a maintainer should review.

**Click to expand conflict summaries.**

Deviation in Backport 30daa12 (cherry-pick of 960b330)

Affected File(s)

Range Diff

Click to expand
--- Original (960b330d)
+++ Backport (30daa120)
@@ -31,3 +31,10 @@
 Tracker: https://tracker.ceph.com/issues/77564
 Reported-by: Saravanan Palanisamy
 Signed-off-by: Lumir Sliva <[email protected]>
+(cherry picked from commit 960b330d87d9fe979e74ada6d7b1ba1fa403e40c)
+
+Conflicts:
+	src/rgw/rgw_rest_s3.cc: req_state::object_key does not exist on
+	this branch (added by f9cf6f6e8b1, not backported). Build the
+	equivalent client request key from the object name plus the
+	requested versionId inline instead.

================================================================================
RANGE DIFF
================================================================================

1:  960b330d87d ! 1:  30daa120099 rgw/lc: report x-amz-expiration only for the current version
    @@ Commit message
         Tracker: https://tracker.ceph.com/issues/77564
         Reported-by: Saravanan Palanisamy
         Signed-off-by: Lumir Sliva <[email protected]>
    +    (cherry picked from commit 960b330d87d9fe979e74ada6d7b1ba1fa403e40c)
    +
    +    Conflicts:
    +            src/rgw/rgw_rest_s3.cc: req_state::object_key does not exist on
    +            this branch (added by f9cf6f6e8b1, not backported). Build the
    +            equivalent client request key from the object name plus the
    +            requested versionId inline instead.
     
      ## src/rgw/rgw_lc.cc ##
     @@ src/rgw/rgw_lc.cc: std::string s3_expiration_header(
    @@ src/rgw/rgw_rest_s3.cc: static inline std::string get_s3_expiration_header(
        req_state* s,
        const ceph::real_time& mtime)
      {
    -+  /* Use the client-supplied request key (s->object_key), not the
    -+   * OLH-resolved key. OLH resolution fills in the current version's instance
    -+   * id even when the client did not request a specific version, which would
    -+   * otherwise make every versioned-bucket response look like a versionId
    -+   * request. s3_expiration_header() keys its current-version decision off an
    -+   * empty instance. */
    ++  /* Build the client-supplied request key rather than reusing the
    ++   * OLH-resolved key from s->object. OLH resolution fills in the current
    ++   * version's instance id even when the client did not request a specific
    ++   * version, which would otherwise make every versioned-bucket response look
    ++   * like a versionId request. s3_expiration_header() keys its current-version
    ++   * decision off an empty instance, so pass the object name with the requested
    ++   * versionId (empty for a plain request). */
        return rgw::lc::s3_expiration_header(
     -    s, s->object->get_key(), s->tagset, mtime, s->bucket_attrs);
    -+    s, s->object_key, s->tagset, mtime, s->bucket_attrs);
    ++    s, rgw_obj_key(s->object->get_key().name, s->info.args.get("versionId")),
    ++    s->tagset, mtime, s->bucket_attrs);
      }
      
      static inline bool get_s3_multipart_abort_header(

How to proceed:

  • Authors (Genuine Conflicts): If this is a genuine conflict requiring manual resolution, ensure your resolution is correct. You must explain the conflict resolution in the commit message (e.g., leave the standard Git Conflicts: block intact) and include an explanation for changes.
  • Authors (Need Help?): Reach out to the Component Lead for technical guidance on complex code conflicts.
  • Component Leads (Review): Please review the Range Diff(s) above to verify the author's manual conflict resolution is correct for this release branch. If the deviation is intentional, documented, and approved then the component lead or @ceph/ceph-release-manager can bypass this check by commenting /audit override.

Be familiar with the rules and guidelines for writing backports.


🛟 Need Help?

If you need technical help resolving these issues, please consult with the Component Lead. If you need administrative overrides, please see the #ceph-upstream-releases channel on Slack and request a review from the @ceph/ceph-release-manager.

📋 Component Lead / Release Manager

To override the audit failure, apply releng-audit-override label or comment /audit override.


⚠️ Note: Automated audit checks will be suspended on future pushes to prevent comment spam while you work.

When you are ready for a new audit, please remove the releng-audit-fail label or comment /audit retest.

View workflow run

@github-actions github-actions Bot added the releng-audit-fail Release engineering: failed backport verification audit. label Jul 24, 2026
@lumir-sliva

Copy link
Copy Markdown
Contributor Author

shaman build creation is failing could you please check

Thanks for catching this, that's on me. The cherry-pick was clean textually but doesn't compile on tentacle: it uses req_state::object_key, which was added to main by f9cf6f6 and never backported, so it blew up with no member named 'object_key' in 'req_state' in rgw_rest_s3.cc.

Reworked it to build the equivalent key inline instead:

rgw_obj_key(s->object->get_key().name, s->info.args.get("versionId"))

which is exactly what object_key holds on main (object name + requested versionId), so the behaviour is identical. Documented it with a Conflicts: note in the commit. Force-pushed (now 30daa120099).

A fresh shaman build should get past compile now, so feel free to re-trigger whenever it suits.

@lumir-sliva

Copy link
Copy Markdown
Contributor Author

@adamemerson Adam, would you be so kind and Clear the Audit report? 🙏

@lumir-sliva

Copy link
Copy Markdown
Contributor Author

@adamemerson Adam, would you be so kind and Clear the Audit report? 🙏

or @cbodley Casey I think only you can do it?

@BBoozmen

BBoozmen commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

@lumir-sliva can you please check this backport again; seems to be causing build failure for tentacle testing:

@anrao19 has added 4 PRs as a part of https://tracker.ceph.com/issues/78633 including this one and builds fail: e.g.,https://jenkins.ceph.com/job/ceph-dev-pipeline/7608/

C{++} Error in /ceph/rpmbuild/BUILD/ceph-20.2.2-418-g016653ef/src/rgw/rgw_rest_s3.cc:128:11
...
error: ‘struct req_state’ has no member named ‘object_key’

@anrao19 I think you'll need to just create a new test branch to pick the latest change on this PR to avoid the build failure.

@lumir-sliva

Copy link
Copy Markdown
Contributor Author

@lumir-sliva can you please check this backport again; seems to be causing build failure for tentacle testing:

@anrao19 has added 4 PRs as a part of https://tracker.ceph.com/issues/78633 including this one and builds fail: e.g.,https://jenkins.ceph.com/job/ceph-dev-pipeline/7608/

C{++} Error in /ceph/rpmbuild/BUILD/ceph-20.2.2-418-g016653ef/src/rgw/rgw_rest_s3.cc:128:11
...
error: ‘struct req_state’ has no member named ‘object_key’

@adamemerson I'm curios now how make check passed then here?

@BBoozmen Yes I fixed it in my latest forced push, look at my comment above, there's an explanation why. And we need the lead, who is Casey to approve/clear the audit report.

@adamemerson

Copy link
Copy Markdown
Contributor

/audit override

@github-actions github-actions Bot added releng-audit-override and removed releng-audit-fail Release engineering: failed backport verification audit. labels Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

✅ Audit Override Applied by @adamemerson.

View workflow run

@anrao19

anrao19 commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

@lumir-sliva can you please check this backport again; seems to be causing build failure for tentacle testing:
@anrao19 has added 4 PRs as a part of https://tracker.ceph.com/issues/78633 including this one and builds fail: e.g.,https://jenkins.ceph.com/job/ceph-dev-pipeline/7608/

C{++} Error in /ceph/rpmbuild/BUILD/ceph-20.2.2-418-g016653ef/src/rgw/rgw_rest_s3.cc:128:11
...
error: ‘struct req_state’ has no member named ‘object_key’

@adamemerson I'm curios now how make check passed then here?

@BBoozmen Yes I fixed it in my latest forced push, look at my comment above, there's an explanation why. And we need the lead, who is Casey to approve/clear the audit report.

@lumir-sliva can you please check this backport again; seems to be causing build failure for tentacle testing:

@anrao19 has added 4 PRs as a part of https://tracker.ceph.com/issues/78633 including this one and builds fail: e.g.,https://jenkins.ceph.com/job/ceph-dev-pipeline/7608/

C{++} Error in /ceph/rpmbuild/BUILD/ceph-20.2.2-418-g016653ef/src/rgw/rgw_rest_s3.cc:128:11
...
error: ‘struct req_state’ has no member named ‘object_key’

@anrao19 I think you'll need to just create a new test branch to pick the latest change on this PR to avoid the build failure.

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

@batrick batrick modified the milestones: tentacle, v20.2.5 Aug 20, 2026
@batrick
batrick merged commit 4da10a4 into ceph:tentacle Aug 20, 2026
10 of 11 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