]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/lc: stop using merge_and_store_attrs in remove_bucket_config 64741/head
authorCasey Bodley <cbodley@redhat.com>
Fri, 25 Apr 2025 17:38:50 +0000 (13:38 -0400)
committerCasey Bodley <cbodley@redhat.com>
Tue, 29 Jul 2025 14:10:51 +0000 (10:10 -0400)
merge_and_store_attrs() is no longer able to remove xattrs. change the
sal::Bucket's attrs manually and call put_info() to write them back

Fixes: https://tracker.ceph.com/issues/71083
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit f3cc52124c650d32be2adf3cf540167142423c42)

Conflicts:
src/rgw/driver/rados/rgw_bucket.cc
src/rgw/driver/rados/rgw_sal_rados.cc
src/rgw/rgw_lc.cc
src/rgw/rgw_lc.h
src/rgw/rgw_op.cc
  mostly because squid doesn't have changes to remove metadata backends

src/rgw/driver/rados/rgw_bucket.cc
src/rgw/driver/rados/rgw_sal_rados.cc
src/rgw/rgw_lc.cc
src/rgw/rgw_lc.h
src/rgw/rgw_op.cc

index 850e99ba1414adf3b4d9e28986bf45528f1c6fa7..ebc452644a477a5f467946fcb0128eae20a5cddd 100644 (file)
@@ -2863,7 +2863,8 @@ int RGWMetadataHandlerPut_BucketInstance::put_post(const DoutPrefixProvider *dpp
 
     } else {
       ldpp_dout(dpp, 20) << "remove lc config for " << bci.info.bucket.name << dendl;
-      ret = lc->remove_bucket_config(bucket.get(), bci.attrs, false /* cannot merge attrs */);
+      constexpr bool update_attrs = false;
+      ret = lc->remove_bucket_config(dpp, y, bucket.get(), update_attrs);
       if (ret < 0) {
              ldpp_dout(dpp, 0) << __func__ << " failed to remove lc config for "
                        << bci.info.bucket.name
index 29e907825baa2f010c345ba29a3b70552705a9ba..65ca6b05d6996b313aeb44a5f98ce4166ebad8b0 100644 (file)
@@ -401,9 +401,9 @@ int RadosBucket::remove(const DoutPrefixProvider* dpp,
 
   // remove lifecycle config, if any (XXX note could be made generic)
   if (get_attrs().count(RGW_ATTR_LC)) {
-    constexpr bool merge_attrs = false; // don't update xattrs, we're deleting
+    constexpr bool update_attrs = false; // don't update xattrs, we're deleting
     (void) store->getRados()->get_lc()->remove_bucket_config(
-      this, get_attrs(), merge_attrs);
+      dpp, y, this, update_attrs);
   }
 
   // remove bucket-topic mapping
index 5e6b9f182d96e884d5fbd79dc2dcdd8c67a4f6fa..3d7d693f2b6e8a15a398a7f64090311d61d5654f 100644 (file)
@@ -2665,18 +2665,17 @@ int RGWLC::set_bucket_config(rgw::sal::Bucket* bucket,
   return ret;
 }
 
-int RGWLC::remove_bucket_config(rgw::sal::Bucket* bucket,
-                                const rgw::sal::Attrs& bucket_attrs,
-                               bool merge_attrs)
+int RGWLC::remove_bucket_config(const DoutPrefixProvider* dpp, optional_yield y,
+                                rgw::sal::Bucket* bucket, bool update_attrs)
 {
-  rgw::sal::Attrs attrs = bucket_attrs;
   rgw_bucket& b = bucket->get_key();
   int ret{0};
 
-  if (merge_attrs) {
-    attrs.erase(RGW_ATTR_LC);
-    ret = bucket->merge_and_store_attrs(this, attrs, null_yield);
-
+  // remove the lifecycle attr if present. if not, try to remove from
+  // the 'lc list' anyway
+  rgw::sal::Attrs& attrs = bucket->get_attrs();
+  if (update_attrs && attrs.erase(RGW_ATTR_LC)) {
+    ret = bucket->put_info(dpp, false, real_time(), y);
     if (ret < 0) {
       ldpp_dout(this, 0) << "RGWLC::RGWDeleteLC() failed to set attrs on bucket="
                         << b.name << " returned err=" << ret << dendl;
index 75244be9a3af17780db9ecb8da13b97f0f47ea3b..d8873574e9c2f5935f27f13c6032f1b39c00050b 100644 (file)
@@ -656,9 +656,10 @@ public:
   int set_bucket_config(rgw::sal::Bucket* bucket,
                         const rgw::sal::Attrs& bucket_attrs,
                         RGWLifecycleConfiguration *config);
-  int remove_bucket_config(rgw::sal::Bucket* bucket,
-                           const rgw::sal::Attrs& bucket_attrs,
-                          bool merge_attrs = true);
+  // remove a bucket from the lc list, and optionally update the bucket
+  // instance metadata to remove RGW_ATTR_LC
+  int remove_bucket_config(const DoutPrefixProvider* dpp, optional_yield y,
+                           rgw::sal::Bucket* bucket, bool update_attrs);
 
   CephContext *get_cct() const override { return cct; }
   rgw::sal::Lifecycle* get_lc() const { return sal_lc.get(); }
index 83d5554c62b119175a591262bd26b842cf0d5ccc..7bc2be53055f3cd4cd907367fbb18f344be6a7f2 100644 (file)
@@ -6028,7 +6028,10 @@ void RGWDeleteLC::execute(optional_yield y)
     return;
   }
 
-  op_ret = driver->get_rgwlc()->remove_bucket_config(s->bucket.get(), s->bucket_attrs);
+  // remove RGW_ATTR_LC and remove the bucket from the 'lc list'
+  constexpr bool update_attrs = true;
+  op_ret = driver->get_rgwlc()->remove_bucket_config(this, y, s->bucket.get(),
+                                                     update_attrs);
   if (op_ret < 0) {
     return;
   }