Skip to content

Commit

Permalink
rgw/multisite: the create_bucket forward request omits the
Browse files Browse the repository at this point in the history
the request body, thus missing some data if specified inside
CreateBucketConfiguration xml on the non-master zone.
also, now that we perform cksum validation against empty payloads,
such a request would fail with -ERR_AMZ_CONTENT_SHA256_MISMATCH due
to a zero content-length but a non-empty payload hash.
this fix ensures that request body is forwarded during create_bucket

Signed-off-by: Shilpa Jagannath <[email protected]>
  • Loading branch information
Shilpa Jagannath committed Jan 8, 2025
1 parent cbbddfd commit 43a6f12
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/rgw/rgw_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3618,7 +3618,6 @@ void RGWCreateBucket::execute(optional_yield y)

if (!driver->is_meta_master()) {
// apply bucket creation on the master zone first
bufferlist in_data;
JSONParser jp;
op_ret = rgw_forward_request_to_master(this, *s->penv.site, s->owner.id,
&in_data, &jp, s->info, y);
Expand Down
1 change: 1 addition & 0 deletions src/rgw/rgw_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,7 @@ class RGWCreateBucket : public RGWOp {
bool relaxed_region_enforcement = false;
RGWCORSConfiguration cors_config;
std::set<std::string> rmattr_names;
bufferlist in_data;

virtual bool need_metadata_upload() const { return false; }

Expand Down
4 changes: 4 additions & 0 deletions src/rgw/rgw_rest_s3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2492,6 +2492,10 @@ int RGWCreateBucket_ObjStore_S3::get_params(optional_yield y)
if ((op_ret < 0) && (op_ret != -ERR_LENGTH_REQUIRED))
return op_ret;

if (!driver->is_meta_master()) {
in_data.append(data);
}

if (data.length()) {
RGWCreateBucketParser parser;

Expand Down

0 comments on commit 43a6f12

Please sign in to comment.