From: Matt Benjamin Date: Thu, 23 Dec 2021 21:51:52 +0000 (-0500) Subject: rgwlc: temporary logic to compensate for rgw::sal::Bucket::get_owner() always nullptr X-Git-Tag: v17.1.0~129^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=dca0ab8f34de795e214baf2acca2db8d5f6287fa;p=ceph-ci.git rgwlc: temporary logic to compensate for rgw::sal::Bucket::get_owner() always nullptr (Acked by Daniel.) Now with less use-after-free. Signed-off-by: Matt Benjamin --- diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index 9af8422d6f2..ea1609bdb9d 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -596,6 +596,17 @@ static int remove_expired_obj( return ret; } + // XXXX currently, rgw::sal::Bucket.owner is always null here + std::unique_ptr user; + if (! bucket->get_owner()) { + auto& bucket_info = bucket->get_info(); + user = store->get_user(bucket_info.owner); + // forgive me, lord + if (user) { + bucket->set_owner(user.get()); + } + } + obj = bucket->get_object(obj_key); std::unique_ptr del_op = obj->get_delete_op(&oc.rctx); diff --git a/src/rgw/rgw_sal.h b/src/rgw/rgw_sal.h index 6fd4c9c0f0b..f138dea6a31 100644 --- a/src/rgw/rgw_sal.h +++ b/src/rgw/rgw_sal.h @@ -638,6 +638,12 @@ class Bucket { virtual RGWAccessControlPolicy& get_acl(void) = 0; /** Set the ACL for this bucket */ virtual int set_acl(const DoutPrefixProvider* dpp, RGWAccessControlPolicy& acl, optional_yield y) = 0; + + // XXXX hack + void set_owner(rgw::sal::User* _owner) { + owner = _owner; + } + /** Load this bucket from the backing store. Requires the key to be set, fills other fields */ virtual int load_bucket(const DoutPrefixProvider* dpp, optional_yield y) = 0; /** Read the bucket stats from the backing Store, synchronous */