From 397e5d5dfc4655eb3cfeb71a02c473710d5a4c71 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Wed, 18 Dec 2024 11:28:02 -0500 Subject: [PATCH] rgw: don't use merge_and_store_attrs() when recreating a bucket https://github.com/ceph/ceph/pull/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 (cherry picked from commit 340e353de6882dcd6e327d6691da9ef2b767ab4f) (cherry picked from commit c5887a763b41aad5d89955e88337288f1019cccc) --- src/rgw/rgw_op.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 6347000f6e8eb..83d5554c62b11 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -3691,7 +3691,10 @@ void RGWCreateBucket::execute(optional_yield y) s->bucket->get_info().has_website = !s->bucket->get_info().website_conf.is_empty(); /* This will also set the quota on the bucket. */ - op_ret = s->bucket->merge_and_store_attrs(this, createparams.attrs, y); + s->bucket->set_attrs(std::move(createparams.attrs)); + constexpr bool exclusive = false; // overwrite + constexpr ceph::real_time no_set_mtime{}; + op_ret = s->bucket->put_info(this, exclusive, no_set_mtime, y); } while (op_ret == -ECANCELED && tries++ < 20); /* Restore the proper return code. */ @@ -4998,7 +5001,10 @@ void RGWPutMetadataBucket::execute(optional_yield y) /* Setting attributes also stores the provided bucket info. Due * to this fact, the new quota settings can be serialized with * the same call. */ - op_ret = s->bucket->merge_and_store_attrs(this, attrs, s->yield); + s->bucket->set_attrs(attrs); + constexpr bool exclusive = false; // overwrite + constexpr ceph::real_time no_set_mtime{}; + op_ret = s->bucket->put_info(this, exclusive, no_set_mtime, s->yield); return op_ret; }, y); } -- 2.39.5