Project

General

Profile

Actions

Bug #68183

closed
KD AM

rgw: conditional write doesn't work in certain scenarios

Bug #68183: rgw: conditional write doesn't work in certain scenarios

Added by kay diam about 2 years ago. Updated about 1 month ago.

Status:
Resolved
Priority:
Normal
Assignee:
Target version:
-
Due date:
% Done:

0%

Source:
Backport:
squid tentacle
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Tags (freeform):
Fixed In:
v20.3.0-1937-g78502297af
Released In:
v21.2.0~2384
Upkeep Timestamp:
2026-10-24T02:06:25+00:00

Description

Ceph supports conditional writing since 2014: https://tracker.ceph.com/issues/8562
However it doesn't work with the following cases:

  • a bucket has versioning enabled
  • it's a multipart upload

Current behavior

S3 API returns 201 even though the If-None-Match: * header was submitted to a bucket with the versioning enabled or during the multipart upload.

Simple bucket

This example works fine

$ curl -XPUT https://my-ceph.local/condition_write/only_once --aws-sigv4 aws:amz:default:s3 -u XX:XX -H "If-None-Match: *" -v -d"This is the first write" 2>&1 | egrep -i 'HTTP|etag|Modified'
* ALPN: curl offers h2,http/1.1
* using HTTP/1.x
> PUT /condition_write/only_once HTTP/1.1
< HTTP/1.1 200 OK
< ETag: "dcc31a80288e0758b0c522eaaa0b5bec" 
$ curl -XPUT https://my-ceph.local/condition_write/only_once --aws-sigv4 aws:amz:default:s3 -u XX:XX -H "If-None-Match: *" -v -d"This is the first write" 2>&1 | egrep -i 'HTTP|etag|Modified'
* ALPN: curl offers h2,http/1.1
* using HTTP/1.x
> PUT /condition_write/only_once HTTP/1.1
< HTTP/1.1 412 Precondition Failed

Bucket with versioning enabled

$ aws --region default --endpoint-url https://my-ceph.local s3api put-bucket-versioning --bucket condition_write --versioning-configuration Status=Enabled
$ curl -XPUT https://my-ceph.local/condition_write/only_once --aws-sigv4 aws:amz:default:s3 -u XX:XX -H "If-None-Match: *" -v -d"This is the first write" 2>&1 | egrep -i 'HTTP|etag|Modified'
* ALPN: curl offers h2,http/1.1
* using HTTP/1.x
> PUT /condition_write/only_once HTTP/1.1
< HTTP/1.1 200 OK
< ETag: "dcc31a80288e0758b0c522eaaa0b5bec" 
$ curl -XPUT https://my-ceph.local/condition_write/only_once --aws-sigv4 aws:amz:default:s3 -u XX:XX -H "If-None-Match: *" -v -d"This is the first write" 2>&1 | egrep -i 'HTTP|etag|Modified'
* ALPN: curl offers h2,http/1.1
* using HTTP/1.x
> PUT /condition_write/only_once HTTP/1.1
< HTTP/1.1 200 OK
< ETag: "dcc31a80288e0758b0c522eaaa0b5bec" 

Multipart upload

Create an initial key and test the second conditional write with the If-None-Match: *

$ curl -XPUT https://my-ceph.local/condition_write/only_once --aws-sigv4 aws:amz:default:s3 -u XX:XX -H "If-None-Match: *" -v -d"This is the first write" 2>&1 | egrep -i 'HTTP|etag|Modified'
* ALPN: curl offers h2,http/1.1
* using HTTP/1.x
> PUT /condition_write/only_once HTTP/1.1
< HTTP/1.1 200 OK
< ETag: "dcc31a80288e0758b0c522eaaa0b5bec" 
$ curl -XPUT https://my-ceph.local/condition_write/only_once --aws-sigv4 aws:amz:default:s3 -u XX:XX -H "If-None-Match: *" -v -d"This is the first write" 2>&1 | egrep -i 'HTTP|etag|Modified'
* ALPN: curl offers h2,http/1.1
* using HTTP/1.x
> PUT /condition_write/only_once HTTP/1.1
< HTTP/1.1 412 Precondition Failed

Run multipart upload against this key:

$ curl -s -XPOST https://my-ceph.local/condition_write/only_once?uploads -H "If-None-Match: *" --aws-sigv4 aws:amz:default:s3 -u XX:XX
<?xml version="1.0" encoding="UTF-8"?><InitiateMultipartUploadResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Tenant>481c6f7874024488a2ab2197e5bb1931</Tenant><Bucket>condition_write</Bucket><Key>only_once</Key><UploadId>2~QcmAkzqsyVF1un_uiLA-Ste89T_ExaN</UploadId></InitiateMultipartUploadResult>
$ curl -XPUT "https://my-ceph.local/condition_write/only_once?partNumber=1&uploadId=2~QcmAkzqsyVF1un_uiLA-Ste89T_ExaN" -H "If-None-Match: *" --aws-sigv4 aws:amz:default:s3 -u XX:XX -d"This is the multipart write" -v
...
< HTTP/1.1 200 OK
< Content-Length: 0
< ETag: "e4683000ff181d33580b4039304880da" 
...
$ curl -XPOST "https://my-ceph.local/condition_write/only_once?uploadId=2~QcmAkzqsyVF1un_uiLA-Ste89T_ExaN" -H "If-None-Match: *" -H "Content-Type: application/xml" --aws-sigv4 aws:amz:default:s3 -u XX:XX -d"<CompleteMultipartUpload><Part><PartNumber>1</PartNumber><ETag>e4683000ff181d33580b4039304880da</ETag></Part></CompleteMultipartUpload>" 
<?xml version="1.0" encoding="UTF-8"?><CompleteMultipartUploadResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Location>my-ceph.local/481c6f7874024488a2ab2197e5bb1931:condition_write/only_once</Location><Tenant>481c6f7874024488a2ab2197e5bb1931</Tenant><Bucket>condition_write</Bucket><Key>only_once</Key><ETag></ETag></CompleteMultipartUploadResult>
$ curl "https://my-ceph.local/condition_write/only_once" --aws-sigv4 aws:amz:default:s3 -u XX:XX 
This is the multipart write

As you see, the object was rewritten with the multipart upload content: This is the multipart write

Expected behavior

All update requests with the If-None-Match: * header must fail with the 412 response code.


Related issues 5 (0 open — 5 closed)

Related to rgw - Feature #67925: AWS S3 Conditional WritesResolved

Actions
Related to rgw - Bug #68185: rgw: conditional write doesn't work with Swift APIResolved

Actions
Copied to rgw - Bug #73076: rgw: conditional write doesn't work with multipart uploadBackportingAli Masarwa

Actions
Copied to rgw - Backport #73089: squid: rgw: conditional write doesn't work in certain scenariosResolvedAli Masarwa

Actions
Copied to rgw - Backport #73090: tentacle: rgw: conditional write doesn't work in certain scenariosResolvedCasey Bodley

Actions

KD Updated by kay diam about 2 years ago Actions #1

  • Subject changed from rgw: conditioning writing doesn't work in certain scenarios to rgw: conditional write doesn't work in certain scenarios

CB Updated by Casey Bodley about 2 years ago Actions #2

JI Updated by J. Eric Ivancich about 2 years ago Actions #3

  • Related to Bug #68185: rgw: conditional write doesn't work with Swift API added

KD Updated by kay diam about 2 years ago Actions #4

In addition, the conditional write feature should be reflected in documentation. Currently there is no info: https://docs.ceph.com/en/latest/radosgw/s3/objectops/

AM Updated by Ali Masarwa about 1 year ago Actions #5

  • Copied to Bug #73076: rgw: conditional write doesn't work with multipart upload added

CB Updated by Casey Bodley about 1 year ago Actions #6

  • Status changed from New to Pending Backport
  • Assignee set to Ali Masarwa
  • Backport set to squid tentacle
  • Pull request ID set to 63348

UB Updated by Upkeep Bot about 1 year ago Actions #8

  • Copied to Backport #73089: squid: rgw: conditional write doesn't work in certain scenarios added

UB Updated by Upkeep Bot about 1 year ago Actions #9

  • Copied to Backport #73090: tentacle: rgw: conditional write doesn't work in certain scenarios added

UB Updated by Upkeep Bot about 1 year ago Actions #10

  • Tags (freeform) set to backport_processed

UB Updated by Upkeep Bot about 1 year ago Actions #11

  • Merge Commit set to 78502297afd074e51e0d2f99fac1b45fc3eaa0c2
  • Fixed In set to v20.3.0-1937-g78502297af
  • Upkeep Timestamp set to 2025-09-17T18:54:59+00:00

UB Updated by Upkeep Bot 3 months ago Actions #12

  • Status changed from Pending Backport to Backporting
  • Tags (freeform) deleted (backport_processed)
  • Upkeep Timestamp changed from 2025-09-17T18:54:59+00:00 to 2026-08-27T18:07:05+00:00

UB Updated by Upkeep Bot 3 months ago Actions #13

  • Status changed from Backporting to Resolved
  • Upkeep Timestamp changed from 2026-08-27T18:07:05+00:00 to 2026-09-11T01:21:19+00:00

UB Updated by Upkeep Bot about 1 month ago Actions #14

  • Released In set to v21.2.0~2384
  • Upkeep Timestamp changed from 2026-09-11T01:21:19+00:00 to 2026-10-24T02:06:25+00:00
Actions

Also available in: PDF Atom