Skip to content

Commit 340e353

Browse files
committed
rgw: don't use merge_and_store_attrs() when recreating a bucket
ceph#56583 recently fixed merge_and_store_attrs() to preserve existing attrs, but this broke the swift api's ability to remove container metadata. RGWCreateBucket handles this merging itself with prepare_add_del_attrs(), so we should just assign createparams.attrs to the bucket and store it with bucket->put_info() make the same change for RGWPutMetadataBucket which swift uses to add/remove existing metadata Fixes: https://tracker.ceph.com/issues/69301 Signed-off-by: Casey Bodley <[email protected]>
1 parent 672d7a1 commit 340e353

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/rgw/rgw_op.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3793,7 +3793,10 @@ void RGWCreateBucket::execute(optional_yield y)
37933793
s->bucket->get_info().has_website = !s->bucket->get_info().website_conf.is_empty();
37943794

37953795
/* This will also set the quota on the bucket. */
3796-
op_ret = s->bucket->merge_and_store_attrs(this, createparams.attrs, y);
3796+
s->bucket->set_attrs(std::move(createparams.attrs));
3797+
constexpr bool exclusive = false; // overwrite
3798+
constexpr ceph::real_time no_set_mtime{};
3799+
op_ret = s->bucket->put_info(this, exclusive, no_set_mtime, y);
37973800
} while (op_ret == -ECANCELED && tries++ < 20);
37983801

37993802
/* Restore the proper return code. */
@@ -5194,7 +5197,10 @@ void RGWPutMetadataBucket::execute(optional_yield y)
51945197
/* Setting attributes also stores the provided bucket info. Due
51955198
* to this fact, the new quota settings can be serialized with
51965199
* the same call. */
5197-
op_ret = s->bucket->merge_and_store_attrs(this, attrs, s->yield);
5200+
s->bucket->set_attrs(attrs);
5201+
constexpr bool exclusive = false; // overwrite
5202+
constexpr ceph::real_time no_set_mtime{};
5203+
op_ret = s->bucket->put_info(this, exclusive, no_set_mtime, s->yield);
51985204
return op_ret;
51995205
}, y);
52005206
}

0 commit comments

Comments
 (0)