]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: don't use merge_and_store_attrs() when recreating a bucket 64411/head
authorCasey Bodley <cbodley@redhat.com>
Wed, 18 Dec 2024 16:28:02 +0000 (11:28 -0500)
committerCasey Bodley <cbodley@redhat.com>
Wed, 9 Jul 2025 13:35:36 +0000 (09:35 -0400)
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 <cbodley@redhat.com>
(cherry picked from commit 340e353de6882dcd6e327d6691da9ef2b767ab4f)

Conflicts:
src/rgw/rgw_op.cc
  local 'attrs' instead of 'createparams.attrs'
  put_info() on reef doesn't take optional_yield

src/rgw/rgw_op.cc

index 2e8c1b74d016eaffb17c87f0a558799b59af42b1..404f72a46cb6105d24bf43d2bc2572a11ba3d645 100644 (file)
@@ -3491,7 +3491,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, attrs, y);
+      s->bucket->set_attrs(std::move(attrs));
+      constexpr bool exclusive = false; // overwrite
+      constexpr ceph::real_time no_set_mtime{};
+      op_ret = s->bucket->put_info(this, exclusive, no_set_mtime);
     } while (op_ret == -ECANCELED && tries++ < 20);
 
     /* Restore the proper return code. */
@@ -4877,7 +4880,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);
       return op_ret;
     });
 }