diff options
author | Casey Bodley <cbodley@redhat.com> | 2022-07-26 23:25:32 +0200 |
---|---|---|
committer | Casey Bodley <cbodley@redhat.com> | 2023-11-06 17:07:23 +0100 |
commit | ab2b45aa184ed3e2b48a98853b6eea87bfc2b31b (patch) | |
tree | d2f2b4cfaf5935d64d1255ba233da9ffef269372 /src/rgw/driver/rados | |
parent | rgw: read existing placement and swift_ver_location outside of sal (diff) | |
download | ceph-ab2b45aa184ed3e2b48a98853b6eea87bfc2b31b.tar.xz ceph-ab2b45aa184ed3e2b48a98853b6eea87bfc2b31b.zip |
rgw/rados: pass obj_lock_enabled into RGWRados::create_bucket
there's a retry loop here that may end up overwriting RGWBucketInfo, so
pass obj_lock_enabled and use it to update info.flags on each iteration
Signed-off-by: Casey Bodley <cbodley@redhat.com>
Diffstat (limited to 'src/rgw/driver/rados')
-rw-r--r-- | src/rgw/driver/rados/rgw_rados.cc | 4 | ||||
-rw-r--r-- | src/rgw/driver/rados/rgw_rados.h | 1 | ||||
-rw-r--r-- | src/rgw/driver/rados/rgw_sal_rados.cc | 13 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/rgw/driver/rados/rgw_rados.cc b/src/rgw/driver/rados/rgw_rados.cc index 2df4f77b673..e2754eead72 100644 --- a/src/rgw/driver/rados/rgw_rados.cc +++ b/src/rgw/driver/rados/rgw_rados.cc @@ -2276,6 +2276,7 @@ int RGWRados::create_bucket(const RGWUserInfo& owner, rgw_bucket& bucket, const string& zonegroup_id, const rgw_placement_rule& placement_rule, const string& swift_ver_location, + bool obj_lock_enabled, const RGWQuotaInfo * pquota_info, map<std::string, bufferlist>& attrs, RGWBucketInfo& info, @@ -2322,6 +2323,9 @@ int RGWRados::create_bucket(const RGWUserInfo& owner, rgw_bucket& bucket, info.placement_rule = selected_placement_rule; info.swift_ver_location = swift_ver_location; info.swift_versioning = (!swift_ver_location.empty()); + if (obj_lock_enabled) { + info.flags |= BUCKET_VERSIONED | BUCKET_OBJ_LOCK_ENABLED; + } init_default_bucket_layout(cct, info.layout, svc.zone->get_zone(), rule_info.index_type); diff --git a/src/rgw/driver/rados/rgw_rados.h b/src/rgw/driver/rados/rgw_rados.h index d312e7355e2..1727bd84758 100644 --- a/src/rgw/driver/rados/rgw_rados.h +++ b/src/rgw/driver/rados/rgw_rados.h @@ -632,6 +632,7 @@ public: const std::string& zonegroup_id, const rgw_placement_rule& placement_rule, const std::string& swift_ver_location, + bool obj_lock_enabled, const RGWQuotaInfo * pquota_info, std::map<std::string,bufferlist>& attrs, RGWBucketInfo& bucket_info, diff --git a/src/rgw/driver/rados/rgw_sal_rados.cc b/src/rgw/driver/rados/rgw_sal_rados.cc index b7a7732388b..bc6efa46196 100644 --- a/src/rgw/driver/rados/rgw_sal_rados.cc +++ b/src/rgw/driver/rados/rgw_sal_rados.cc @@ -140,7 +140,7 @@ int RadosUser::create_bucket(const DoutPrefixProvider* dpp, int ret; bufferlist in_data; RGWBucketInfo master_info; - rgw_bucket* pmaster_bucket; + rgw_bucket* pmaster_bucket = nullptr; real_time creation_time; std::unique_ptr<Bucket> bucket; obj_version objv,* pobjv = NULL; @@ -174,13 +174,7 @@ int RadosUser::create_bucket(const DoutPrefixProvider* dpp, pmaster_bucket= &master_info.bucket; creation_time = master_info.creation_time; pobjv = &objv; - if (master_info.obj_lock_enabled()) { - info.flags = BUCKET_VERSIONED | BUCKET_OBJ_LOCK_ENABLED; - } - } else { - pmaster_bucket = NULL; - if (obj_lock_enabled) - info.flags = BUCKET_VERSIONED | BUCKET_OBJ_LOCK_ENABLED; + obj_lock_enabled = master_info.obj_lock_enabled(); } std::string zid = zonegroup_id; @@ -201,7 +195,8 @@ int RadosUser::create_bucket(const DoutPrefixProvider* dpp, } else { ret = store->getRados()->create_bucket(this->get_info(), bucket->get_key(), - zid, placement_rule, swift_ver_location, pquota_info, + zid, placement_rule, swift_ver_location, + obj_lock_enabled, pquota_info, attrs, info, pobjv, &ep_objv, creation_time, pmaster_bucket, y, dpp, exclusive); if (ret == -EEXIST) { |