Skip to content

rgw: evaluate If-Match before If-Modified-Since on GET - #73205

Open
RaminNietzsche wants to merge 1 commit into
ceph:mainfrom
RaminNietzsche:wip-rgw-precondition-order
Open

RaminNietzsche wants to merge 1 commit into
ceph:mainfrom
RaminNietzsche:wip-rgw-precondition-order

Conversation

@RaminNietzsche

Copy link
Copy Markdown
Member

Summary

RFC 9110 13.2.2 evaluates If-Match before If-Modified-Since. RGW checked date preconditions first in Object::Read::prepare, so GetObject with a failing If-Match and a future If-Modified-Since was answered 304 instead of 412.

  • Swap the entity-tag and date precondition blocks in the RADOS and POSIX read prepare paths. Guards that skip If-Modified-Since when If-None-Match is present (and If-Unmodified-Since when If-Match is present) are unchanged.
  • s3-tests: test_get_object_ifmatch_failed_with_ifmodifiedsince (412) and test_get_object_ifmatch_good_with_ifmodifiedsince_future (304 when ETag matches).

Fixes: https://tracker.ceph.com/issues/82233
Fixes: https://tracker.ceph.com/issues/19965

Probe script (case T4 If-Match fails + If-Modified-Since future): https://gist.github.com/RaminNietzsche/818ad8dd6b8d8093560183cd09d2b169

Testing

On a single-host vstart cluster built from this branch (tree at 5ab2b0ddb70 + this commit):

Request main this branch
If-Match: "ABCORZ" + If-Modified-Since: 2100-01-01 304 412 PreconditionFailed
If-Match: <etag> + If-Modified-Since: 2100-01-01 (304) 304

s3-tests: -k "test_get_object_ifmatch_failed_with_ifmodifiedsince or test_get_object_ifmatch_good_with_ifmodifiedsince_future" — 2 passed.

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.

RFC 9110 section 13.2.2 evaluates If-Match before If-Modified-Since.
RGW checked the date preconditions first in Object::Read::prepare, so
GetObject with a failing If-Match and a future If-Modified-Since was
answered 304 Not Modified instead of 412 Precondition Failed.

Evaluate entity-tag preconditions before the date block in the RADOS
and POSIX read prepare paths. The existing guards that skip
If-Modified-Since when If-None-Match is present, and
If-Unmodified-Since when If-Match is present, are unchanged.

Fixes: https://tracker.ceph.com/issues/82233
Fixes: https://tracker.ceph.com/issues/19965
Signed-off-by: ramin.najarbashi <[email protected]>
@RaminNietzsche

Copy link
Copy Markdown
Member Author

RFC 9110 RGW audit — series context

This PR is one focused change from an RFC 9110 conformance review of RGW (S3, Swift, Admin, STS). Each PR is meant to review and merge on its own; there is no batch dependency unless called out below.

Item PR Tracker
T1 — 416 + Content-Range #73200 #82229
T4b — CopyObject source preconditions → 412 #73201 #82230
T4a — If-Match before If-Modified-Since #73205 #82233 (Fixes #19965)
T5 — 405 + Allow, 501 for unknown methods #73206 #82235
T6 — Swift 401 + WWW-Authenticate #73209 #82242

Same audit, already tracked on other PRs (not part of this series authorship):

Item PR Tracker
T2 — Range header parsing #71300 #13412
T3 — whole-tag If-Match / If-None-Match #72117 #80924

Follow-ups from the audit not opened yet: T4d If-Range (best after #71300 and #72117 land), T8b header field section too large → 431, T9 admin GET ?sync=true side effects.

Shared repro script and sample output: https://gist.github.com/RaminNietzsche/818ad8dd6b8d8093560183cd09d2b169 (rgw-rfc9110-repro.py; cases T1–T8).

This PR (T4a): RFC 9110 §13.2.2 — when both If-Match and If-Modified-Since are present, a failed entity tag must win over a satisfied date (412, not 304). Complements #72117 (whole-tag comparison) but does not depend on it for merge.

@RaminNietzsche

Copy link
Copy Markdown
Member Author

jenkins test make check arm64

@RaminNietzsche

Copy link
Copy Markdown
Member Author

@adamemerson Thanks for the approval. CI is green now (the make check (arm64) re-run passed). Could you add needs-qa or include this in an rgw teuthology run when you have a chance?

@adamemerson

Copy link
Copy Markdown
Contributor

Yes, sorry, forgot to add that.

@anrao19

anrao19 commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to wip-anrao6-testing-2026-11-13-0833-main.

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