From aa90cbdf74f4368aa6a989f35142110d8a57d5d1 Mon Sep 17 00:00:00 2001 From: Matt Benjamin Date: Tue, 4 Jan 2022 11:22:00 -0500 Subject: [PATCH] rgwlc: remove lc entry on bucket delete Buckets with lifecycle policies installed have a state entry that must also be deleted when the bucket is removed. Fixes: https://tracker.ceph.com/issues/46728 N.b., should really be generic, not specific to the RADOS store, but there doesn't seem to be a clean model for implementing generic side effects in Zipper, currently. Signed-off-by: Matt Benjamin (cherry picked from commit cc1e812a003e2af74fe0c69ccae08dd7aa68bbe0) Conflicts: src/rgw/rgw_sal_rados.cc Cherry-pick notes: - must pass this->info as first param to remove_bucket_config - conflict with includes --- src/rgw/rgw_sal_rados.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/rgw/rgw_sal_rados.cc b/src/rgw/rgw_sal_rados.cc index 28f1cef9ffefd..48bc7b53e94ed 100644 --- a/src/rgw/rgw_sal_rados.cc +++ b/src/rgw/rgw_sal_rados.cc @@ -30,6 +30,8 @@ #include "rgw_zone.h" #include "rgw_rest_conn.h" +#include "rgw_service.h" +#include "rgw_lc.h" #include "services/svc_sys_obj.h" #include "services/svc_zone.h" #include "services/svc_tier_rados.h" @@ -132,6 +134,10 @@ int RGWRadosBucket::remove_bucket(const DoutPrefixProvider *dpp, return ret; } + // remove lifecycle config, if any (XXX note could be made generic) + (void) store->getRados()->get_lc()->remove_bucket_config( + this->info, get_attrs()); + ret = store->ctl()->bucket->sync_user_stats(dpp, info.owner, info, y); if (ret < 0) { ldout(store->ctx(), 1) << "WARNING: failed sync user stats before bucket delete. ret=" << ret << dendl; -- 2.39.5