Project

General

Profile

Actions

Bug #80925

open
KB KB

rgw: conditional writes in a versioning-enabled bucket are not atomic

Bug #80925: rgw: conditional writes in a versioning-enabled bucket are not atomic

Added by Kyle Bader 2 months ago. Updated about 1 month ago.

Status:
Fix Under Review
Priority:
Normal
Assignee:
Target version:
-
Due date:
% Done:

0%

Source:
Backport:
tentacle, umbrella
Regression:
No
Severity:
2 - major
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Tags (freeform):
Merge Commit:
Fixed In:
Released In:
Upkeep Timestamp:

Description

Found reviewing RGW's parsers against AWS's Smithy model of S3. Reproduced on main at 7ed73efc1be on a single-host vstart cluster, with the injection points of #72096. By code review, tentacle has the same code.

In a versioning-enabled bucket, a write goes to a new instance head:
  • write_meta adds no guard on the ID tag, because set_attr_id_tag requires an empty instance (rgw_rados.cc:3470).
  • The condition is checked only against the current version as read earlier (get_current_version_state, check_preconditions, rgw_rados.cc:3465).

So two PutObjects with If-None-Match: * on a new key both find no current version, and both succeed. The same holds for If-Match, and for CompleteMultipartUpload with either header.

S3 lets one succeed: "If multiple conditional writes or copies occur for the same object name, the first write operation to finish succeeds. Amazon S3 then fails subsequent writes with a 412 Precondition Failed response" (S3 User Guide, conditional writes). Applications that use If-None-Match: * for a lock, or to create exactly once, get two winners.

Reproducer: test_versioned_put_object_if_none_match_racing in s3-tests (marker rgw_inject). It needs rgw_inject_delay_pattern = write_meta_before_head_write and rgw_inject_delay_sec on the gateway. Both creates are answered 200.

A fix needs the condition checked atomically with the update that makes the new version current.


Files

P2-V-04-repro.py (10.9 KB) P2-V-04-repro.py Joshua Hoblitt, 10/29/2026 10:28 PM
P2-V-04-repro-output.txt (11.4 KB) P2-V-04-repro-output.txt Joshua Hoblitt, 10/29/2026 10:28 PM

Related issues 1 (0 open — 1 closed)

Related to rgw - Bug #80325: rgw: conditional writes on a versioning-suspended bucket see the delete marker as the current objectResolvedMatthew Heler

Actions

KB Updated by Kyle Bader 2 months ago Actions #1

  • Related to Bug #80325: rgw: conditional writes on a versioning-suspended bucket see the delete marker as the current object added

MH Updated by Matthew Heler 2 months ago Actions #2

  • Pull request ID set to 72118

MH Updated by Matthew Heler 2 months ago Actions #3

  • Backport changed from tentacle to tentacle, umbrella

MH Updated by Matthew Heler 2 months ago Actions #4

  • Status changed from New to Fix Under Review
  • Assignee set to Kyle Bader

JH Updated by Joshua Hoblitt about 1 month ago Actions #5

This is @jhoblitt's AI agent.

Confirming this on a running cluster (disposable single-zone rooket cluster, Rook v1.20.7, radosgw 20.2.4 (7f793731f1b)). Eight concurrent PutObject requests with If-None-Match: * for a new key in a versioning-enabled bucket all answered 200, in each of 3 rounds, and ListObjectVersions listed 8 versions each time. Controls: on an unversioned bucket only 1 of 8 succeeded, and a sequential If-None-Match: * over an existing key answered 412. On a versioning-suspended bucket 1 of 8 succeeded, as expected at 20.2.4.

The attached reproducer (endpoint and credentials as parameters, exit 0 = reproduced) and its output are from that run.

Actions

Also available in: PDF Atom