]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: no null_yield in rgw_tools
authorAdam C. Emerson <aemerson@redhat.com>
Wed, 11 Nov 2020 19:06:07 +0000 (14:06 -0500)
committerAdam C. Emerson <aemerson@redhat.com>
Fri, 13 Nov 2020 19:35:15 +0000 (14:35 -0500)
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
17 files changed:
src/rgw/rgw_admin.cc
src/rgw/rgw_lua.cc
src/rgw/rgw_oidc_provider.cc
src/rgw/rgw_oidc_provider.h
src/rgw/rgw_pubsub.cc
src/rgw/rgw_pubsub.h
src/rgw/rgw_rest_oidc_provider.cc
src/rgw/rgw_rest_pubsub.cc
src/rgw/rgw_rest_pubsub_common.cc
src/rgw/rgw_rest_role.cc
src/rgw/rgw_role.cc
src/rgw/rgw_role.h
src/rgw/rgw_sync_module_pubsub_rest.cc
src/rgw/rgw_tools.cc
src/rgw/rgw_tools.h
src/rgw/services/svc_mdlog.cc
src/rgw/services/svc_mdlog.h

index fd5837bf6526125dd97338478480cd4be148ea0c..5651019cfb3e710d10ace32e6544888f5b7312a1 100644 (file)
@@ -5755,7 +5755,7 @@ int main(int argc, const char **argv)
         return -EINVAL;
       }
       RGWRole role(g_ceph_context, store->getRados()->pctl, role_name, path, assume_role_doc, tenant);
-      ret = role.create(true);
+      ret = role.create(true, null_yield);
       if (ret < 0) {
         return -ret;
       }
@@ -5769,7 +5769,7 @@ int main(int argc, const char **argv)
         return -EINVAL;
       }
       RGWRole role(g_ceph_context, store->getRados()->pctl, role_name, tenant);
-      ret = role.delete_obj();
+      ret = role.delete_obj(null_yield);
       if (ret < 0) {
         return -ret;
       }
@@ -5816,7 +5816,7 @@ int main(int argc, const char **argv)
         return -ret;
       }
       role.update_trust_policy(assume_role_doc);
-      ret = role.update();
+      ret = role.update(null_yield);
       if (ret < 0) {
         return -ret;
       }
@@ -5864,7 +5864,7 @@ int main(int argc, const char **argv)
         return -ret;
       }
       role.set_perm_policy(policy_name, perm_policy_doc);
-      ret = role.update();
+      ret = role.update(null_yield);
       if (ret < 0) {
         return -ret;
       }
@@ -5930,7 +5930,7 @@ int main(int argc, const char **argv)
       if (ret < 0) {
         return -ret;
       }
-      ret = role.update();
+      ret = role.update(null_yield);
       if (ret < 0) {
         return -ret;
       }
@@ -6654,7 +6654,7 @@ next:
     RGWDataAccess::BucketRef b;
     RGWDataAccess::ObjectRef obj;
 
-    int ret = data_access.get_bucket(tenant, bucket_name, bucket_id, &b);
+    int ret = data_access.get_bucket(tenant, bucket_name, bucket_id, &b, null_yield);
     if (ret < 0) {
       cerr << "ERROR: failed to init bucket: " << cpp_strerror(-ret) << std::endl;
       return -ret;
@@ -9185,7 +9185,7 @@ next:
     RGWUserInfo& user_info = user_op.get_user_info();
     RGWUserPubSub ups(store, user_info.user_id);
 
-    ret = ups.remove_topic(topic_name);
+    ret = ups.remove_topic(topic_name, null_yield);
     if (ret < 0) {
       cerr << "ERROR: could not remove topic: " << cpp_strerror(-ret) << std::endl;
       return -ret;
@@ -9237,7 +9237,7 @@ next:
     RGWUserPubSub ups(store, user_info.user_id);
 
     auto sub = ups.get_sub(sub_name);
-    ret = sub->unsubscribe(topic_name);
+    ret = sub->unsubscribe(topic_name, null_yield);
     if (ret < 0) {
       cerr << "ERROR: could not get subscription info: " << cpp_strerror(-ret) << std::endl;
       return -ret;
index cc2c5aab22756366eed40c36f0de39d37e2b0f3e..18a4135a58fe67ca19118207cd9b2ed16849921b 100644 (file)
@@ -101,13 +101,14 @@ int write_script(rgw::sal::RGWRadosStore* store, const std::string& tenant, opti
   ceph::encode(script, bl);
 
   const auto rc = rgw_put_system_obj(
-      obj_ctx, 
-      obj.pool, 
+      obj_ctx,
+      obj.pool,
       obj.oid,
       bl,
-      false, 
+      false,
       &objv_tracker,
-      real_time());
+      real_time(),
+      y);
 
   if (rc < 0) {
     return rc;
@@ -125,9 +126,10 @@ int delete_script(rgw::sal::RGWRadosStore* store, const std::string& tenant, opt
 
   const auto rc = rgw_delete_system_obj(
       store->svc()->sysobj, 
-      obj.pool, 
+      obj.pool,
       obj.oid,
-      &objv_tracker);
+      &objv_tracker,
+      y);
 
   if (rc < 0 && rc != -ENOENT) {
     return rc;
index 14eea2f76f8fd9b7e5c9f32790104d1966a02c42..b9aceac83d04d2173b98aeafe1c56d9930c1b80e 100644 (file)
@@ -27,7 +27,8 @@
 const string RGWOIDCProvider::oidc_url_oid_prefix = "oidc_url.";
 const string RGWOIDCProvider::oidc_arn_prefix = "arn:aws:iam::";
 
-int RGWOIDCProvider::store_url(const string& url, bool exclusive)
+int RGWOIDCProvider::store_url(const string& url, bool exclusive,
+                              optional_yield y)
 {
   using ceph::encode;
   string oid = tenant + get_url_oid_prefix() + url;
@@ -38,7 +39,7 @@ int RGWOIDCProvider::store_url(const string& url, bool exclusive)
   encode(*this, bl);
   auto obj_ctx = svc->sysobj->init_obj_ctx();
   return rgw_put_system_obj(obj_ctx, svc->zone->get_zone_params().oidc_pool, oid,
-                            bl, exclusive, NULL, real_time(), NULL);
+                            bl, exclusive, NULL, real_time(), y);
 }
 
 int RGWOIDCProvider::get_tenant_url_from_arn(string& tenant, string& url)
@@ -56,7 +57,7 @@ int RGWOIDCProvider::get_tenant_url_from_arn(string& tenant, string& url)
   return 0;
 }
 
-int RGWOIDCProvider::create(bool exclusive)
+int RGWOIDCProvider::create(bool exclusive, optional_yield y)
 {
   int ret;
 
@@ -97,7 +98,7 @@ int RGWOIDCProvider::create(bool exclusive)
   auto svc = ctl->svc;
 
   auto& pool = svc->zone->get_zone_params().oidc_pool;
-  ret = store_url(idp_url, exclusive);
+  ret = store_url(idp_url, exclusive, y);
   if (ret < 0) {
     ldout(cct, 0) << "ERROR:  storing role info in pool: " << pool.name << ": "
                   << provider_url << ": " << cpp_strerror(-ret) << dendl;
@@ -107,7 +108,7 @@ int RGWOIDCProvider::create(bool exclusive)
   return 0;
 }
 
-int RGWOIDCProvider::delete_obj()
+int RGWOIDCProvider::delete_obj(optional_yield y)
 {
   auto svc = ctl->svc;
   auto& pool = svc->zone->get_zone_params().oidc_pool;
@@ -127,7 +128,7 @@ int RGWOIDCProvider::delete_obj()
 
   // Delete url
   string oid = tenant + get_url_oid_prefix() + url;
-  ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL);
+  ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL, y);
   if (ret < 0) {
     ldout(cct, 0) << "ERROR: deleting oidc url from pool: " << pool.name << ": "
                   << provider_url << ": " << cpp_strerror(-ret) << dendl;
index fc14d10ac0f85c5e30cbaec0851901cd15d7be80..f8ecb7b59a91270ae4cf56d318d5bbe68289f12b 100644 (file)
@@ -7,6 +7,9 @@
 #include <string>
 
 #include "common/ceph_context.h"
+#include "common/ceph_json.h"
+
+#include "rgw/rgw_rados.h"
 
 class RGWCtl;
 
@@ -32,7 +35,7 @@ class RGWOIDCProvider
   vector<string> thumbprints;
 
   int get_tenant_url_from_arn(string& tenant, string& url);
-  int store_url(const string& url, bool exclusive);
+  int store_url(const string& url, bool exclusive, optional_yield y);
   int read_url(const string& url, const string& tenant);
   bool validate_input();
 
@@ -107,8 +110,8 @@ public:
   const vector<string>& get_client_ids() const { return client_ids;}
   const vector<string>& get_thumbprints() const { return thumbprints; }
 
-  int create(bool exclusive);
-  int delete_obj();
+  int create(bool exclusive, optional_yield y);
+  int delete_obj(optional_yield y);
   int get();
   void dump(Formatter *f) const;
   void dump_all(Formatter *f) const;
index 0df56cbf773745005f67c1a054372c9098e977c5..d3a27807c3b66c0dfb03965db2b3a6f0d5bce9ce 100644 (file)
@@ -394,9 +394,11 @@ RGWUserPubSub::RGWUserPubSub(rgw::sal::RGWRadosStore* _store, const rgw_user& _u
     get_user_meta_obj(&user_meta_obj);
 }
 
-int RGWUserPubSub::remove(const rgw_raw_obj& obj, RGWObjVersionTracker *objv_tracker)
+int RGWUserPubSub::remove(const rgw_raw_obj& obj,
+                         RGWObjVersionTracker *objv_tracker,
+                         optional_yield y)
 {
-  int ret = rgw_delete_system_obj(store->svc()->sysobj, obj.pool, obj.oid, objv_tracker);
+  int ret = rgw_delete_system_obj(store->svc()->sysobj, obj.pool, obj.oid, objv_tracker, y);
   if (ret < 0) {
     return ret;
   }
@@ -414,9 +416,10 @@ int RGWUserPubSub::read_user_topics(rgw_pubsub_user_topics *result, RGWObjVersio
   return 0;
 }
 
-int RGWUserPubSub::write_user_topics(const rgw_pubsub_user_topics& topics, RGWObjVersionTracker *objv_tracker)
+int RGWUserPubSub::write_user_topics(const rgw_pubsub_user_topics& topics,
+                                    RGWObjVersionTracker *objv_tracker, optional_yield y)
 {
-  int ret = write(user_meta_obj, topics, objv_tracker);
+  int ret = write(user_meta_obj, topics, objv_tracker, y);
   if (ret < 0 && ret != -ENOENT) {
     ldout(store->ctx(), 1) << "ERROR: failed to write topics info: ret=" << ret << dendl;
     return ret;
@@ -439,9 +442,11 @@ int RGWUserPubSub::Bucket::read_topics(rgw_pubsub_bucket_topics *result, RGWObjV
   return 0;
 }
 
-int RGWUserPubSub::Bucket::write_topics(const rgw_pubsub_bucket_topics& topics, RGWObjVersionTracker *objv_tracker)
+int RGWUserPubSub::Bucket::write_topics(const rgw_pubsub_bucket_topics& topics,
+                                       RGWObjVersionTracker *objv_tracker,
+                                       optional_yield y)
 {
-  int ret = ps->write(bucket_meta_obj, topics, objv_tracker);
+  int ret = ps->write(bucket_meta_obj, topics, objv_tracker, y);
   if (ret < 0) {
     ldout(ps->store->ctx(), 1) << "ERROR: failed to write bucket topics info: ret=" << ret << dendl;
     return ret;
@@ -493,11 +498,11 @@ int RGWUserPubSub::get_topic(const string& name, rgw_pubsub_topic *result)
   return 0;
 }
 
-int RGWUserPubSub::Bucket::create_notification(const string& topic_name, const rgw::notify::EventTypeList& events) {
-    return create_notification(topic_name, events, std::nullopt, "");
+int RGWUserPubSub::Bucket::create_notification(const string& topic_name, const rgw::notify::EventTypeList& events, optional_yield y) {
+  return create_notification(topic_name, events, std::nullopt, "", y);
 }
 
-int RGWUserPubSub::Bucket::create_notification(const string& topic_name, const rgw::notify::EventTypeList& events, OptionalFilter s3_filter, const std::string& notif_name) {
+int RGWUserPubSub::Bucket::create_notification(const string& topic_name,const rgw::notify::EventTypeList& events, OptionalFilter s3_filter, const std::string& notif_name, optional_yield y) {
   rgw_pubsub_topic_subs user_topic_info;
   rgw::sal::RGWRadosStore *store = ps->store;
 
@@ -528,7 +533,7 @@ int RGWUserPubSub::Bucket::create_notification(const string& topic_name, const r
     topic_filter.s3_filter = *s3_filter;
   }
 
-  ret = write_topics(bucket_topics, &objv_tracker);
+  ret = write_topics(bucket_topics, &objv_tracker, y);
   if (ret < 0) {
     ldout(store->ctx(), 1) << "ERROR: failed to write topics to bucket '" << bucket.name << "': ret=" << ret << dendl;
     return ret;
@@ -539,7 +544,7 @@ int RGWUserPubSub::Bucket::create_notification(const string& topic_name, const r
   return 0;
 }
 
-int RGWUserPubSub::Bucket::remove_notification(const string& topic_name)
+int RGWUserPubSub::Bucket::remove_notification(const string& topic_name, optional_yield y)
 {
   rgw_pubsub_topic_subs user_topic_info;
   rgw::sal::RGWRadosStore *store = ps->store;
@@ -561,7 +566,7 @@ int RGWUserPubSub::Bucket::remove_notification(const string& topic_name)
 
   bucket_topics.topics.erase(topic_name);
 
-  ret = write_topics(bucket_topics, &objv_tracker);
+  ret = write_topics(bucket_topics, &objv_tracker, y);
   if (ret < 0) {
     ldout(store->ctx(), 1) << "ERROR: failed to write topics info: ret=" << ret << dendl;
     return ret;
@@ -570,11 +575,11 @@ int RGWUserPubSub::Bucket::remove_notification(const string& topic_name)
   return 0;
 }
 
-int RGWUserPubSub::create_topic(const string& name) {
-  return create_topic(name, rgw_pubsub_sub_dest(), "", "");
+int RGWUserPubSub::create_topic(const string& name, optional_yield y) {
+  return create_topic(name, rgw_pubsub_sub_dest(), "", "", y);
 }
 
-int RGWUserPubSub::create_topic(const string& name, const rgw_pubsub_sub_dest& dest, const std::string& arn, const std::string& opaque_data) {
+int RGWUserPubSub::create_topic(const string& name, const rgw_pubsub_sub_dest& dest, const std::string& arn, const std::string& opaque_data, optional_yield y) {
   RGWObjVersionTracker objv_tracker;
   rgw_pubsub_user_topics topics;
 
@@ -592,7 +597,7 @@ int RGWUserPubSub::create_topic(const string& name, const rgw_pubsub_sub_dest& d
   new_topic.topic.arn = arn;
   new_topic.topic.opaque_data = opaque_data;
 
-  ret = write_user_topics(topics, &objv_tracker);
+  ret = write_user_topics(topics, &objv_tracker, y);
   if (ret < 0) {
     ldout(store->ctx(), 1) << "ERROR: failed to write topics info: ret=" << ret << dendl;
     return ret;
@@ -601,7 +606,7 @@ int RGWUserPubSub::create_topic(const string& name, const rgw_pubsub_sub_dest& d
   return 0;
 }
 
-int RGWUserPubSub::remove_topic(const string& name)
+int RGWUserPubSub::remove_topic(const string& name, optional_yield y)
 {
   RGWObjVersionTracker objv_tracker;
   rgw_pubsub_user_topics topics;
@@ -618,7 +623,7 @@ int RGWUserPubSub::remove_topic(const string& name)
 
   topics.topics.erase(name);
 
-  ret = write_user_topics(topics, &objv_tracker);
+  ret = write_user_topics(topics, &objv_tracker, y);
   if (ret < 0) {
     ldout(store->ctx(), 1) << "ERROR: failed to remove topics info: ret=" << ret << dendl;
     return ret;
@@ -637,9 +642,11 @@ int RGWUserPubSub::Sub::read_sub(rgw_pubsub_sub_config *result, RGWObjVersionTra
   return 0;
 }
 
-int RGWUserPubSub::Sub::write_sub(const rgw_pubsub_sub_config& sub_conf, RGWObjVersionTracker *objv_tracker)
+int RGWUserPubSub::Sub::write_sub(const rgw_pubsub_sub_config& sub_conf,
+                                 RGWObjVersionTracker *objv_tracker,
+                                 optional_yield y)
 {
-  int ret = ps->write(sub_meta_obj, sub_conf, objv_tracker);
+  int ret = ps->write(sub_meta_obj, sub_conf, objv_tracker, y);
   if (ret < 0) {
     ldout(ps->store->ctx(), 1) << "ERROR: failed to write subscription info: ret=" << ret << dendl;
     return ret;
@@ -648,9 +655,10 @@ int RGWUserPubSub::Sub::write_sub(const rgw_pubsub_sub_config& sub_conf, RGWObjV
   return 0;
 }
 
-int RGWUserPubSub::Sub::remove_sub(RGWObjVersionTracker *objv_tracker)
+int RGWUserPubSub::Sub::remove_sub(RGWObjVersionTracker *objv_tracker,
+                                  optional_yield y)
 {
-  int ret = ps->remove(sub_meta_obj, objv_tracker);
+  int ret = ps->remove(sub_meta_obj, objv_tracker, y);
   if (ret < 0) {
     ldout(ps->store->ctx(), 1) << "ERROR: failed to remove subscription info: ret=" << ret << dendl;
     return ret;
@@ -664,7 +672,7 @@ int RGWUserPubSub::Sub::get_conf(rgw_pubsub_sub_config *result)
   return read_sub(result, nullptr);
 }
 
-int RGWUserPubSub::Sub::subscribe(const string& topic, const rgw_pubsub_sub_dest& dest, const std::string& s3_id)
+int RGWUserPubSub::Sub::subscribe(const string& topic, const rgw_pubsub_sub_dest& dest, optional_yield y, const std::string& s3_id)
 {
   RGWObjVersionTracker user_objv_tracker;
   rgw_pubsub_user_topics topics;
@@ -694,13 +702,13 @@ int RGWUserPubSub::Sub::subscribe(const string& topic, const rgw_pubsub_sub_dest
 
   t.subs.insert(sub);
 
-  ret = ps->write_user_topics(topics, &user_objv_tracker);
+  ret = ps->write_user_topics(topics, &user_objv_tracker, y);
   if (ret < 0) {
     ldout(store->ctx(), 1) << "ERROR: failed to write topics info: ret=" << ret << dendl;
     return ret;
   }
 
-  ret = write_sub(sub_conf, nullptr);
+  ret = write_sub(sub_conf, nullptr, y);
   if (ret < 0) {
     ldout(store->ctx(), 1) << "ERROR: failed to write subscription info: ret=" << ret << dendl;
     return ret;
@@ -708,7 +716,7 @@ int RGWUserPubSub::Sub::subscribe(const string& topic, const rgw_pubsub_sub_dest
   return 0;
 }
 
-int RGWUserPubSub::Sub::unsubscribe(const string& _topic)
+int RGWUserPubSub::Sub::unsubscribe(const string& _topic, optional_yield y)
 {
   string topic = _topic;
   RGWObjVersionTracker sobjv_tracker;
@@ -738,7 +746,7 @@ int RGWUserPubSub::Sub::unsubscribe(const string& _topic)
 
       t.subs.erase(sub);
 
-      ret = ps->write_user_topics(topics, &objv_tracker);
+      ret = ps->write_user_topics(topics, &objv_tracker, y);
       if (ret < 0) {
         ldout(store->ctx(), 1) << "ERROR: failed to write topics info: ret=" << ret << dendl;
         return ret;
@@ -746,7 +754,7 @@ int RGWUserPubSub::Sub::unsubscribe(const string& _topic)
     }
   }
 
-  ret = remove_sub(&sobjv_tracker);
+  ret = remove_sub(&sobjv_tracker, y);
   if (ret < 0) {
     ldout(store->ctx(), 1) << "ERROR: failed to delete subscription info: ret=" << ret << dendl;
     return ret;
index 40a0b3b108e5b62ffc662603f7d04615959914ca..8c76a4df2010f3de3488efe8af8be425d8465395 100644 (file)
@@ -612,12 +612,15 @@ class RGWUserPubSub
   int read(const rgw_raw_obj& obj, T *data, RGWObjVersionTracker *objv_tracker);
 
   template <class T>
-  int write(const rgw_raw_obj& obj, const T& info, RGWObjVersionTracker *obj_tracker);
+  int write(const rgw_raw_obj& obj, const T& info,
+           RGWObjVersionTracker *obj_tracker, optional_yield y);
 
-  int remove(const rgw_raw_obj& obj, RGWObjVersionTracker *objv_tracker);
+  int remove(const rgw_raw_obj& obj, RGWObjVersionTracker *objv_tracker,
+            optional_yield y);
 
   int read_user_topics(rgw_pubsub_user_topics *result, RGWObjVersionTracker *objv_tracker);
-  int write_user_topics(const rgw_pubsub_user_topics& topics, RGWObjVersionTracker *objv_tracker);
+  int write_user_topics(const rgw_pubsub_user_topics& topics,
+                       RGWObjVersionTracker *objv_tracker, optional_yield y);
 
 public:
   RGWUserPubSub(rgw::sal::RGWRadosStore *_store, const rgw_user& _user);
@@ -635,7 +638,8 @@ public:
     // set the list of topics associated with a bucket
     // use version tacker to enforce atomicity between read/write
     // return 0 on success, error code otherwise
-    int write_topics(const rgw_pubsub_bucket_topics& topics, RGWObjVersionTracker *objv_tracker);
+    int write_topics(const rgw_pubsub_bucket_topics& topics,
+                    RGWObjVersionTracker *objv_tracker, optional_yield y);
   public:
     Bucket(RGWUserPubSub *_ps, const rgw_bucket& _bucket) : ps(_ps), bucket(_bucket) {
       ps->get_bucket_meta_obj(bucket, &bucket_meta_obj);
@@ -650,13 +654,13 @@ public:
     // for S3 compliant notifications the version with: s3_filter and notif_name should be used
     // return -ENOENT if the topic does not exists
     // return 0 on success, error code otherwise
-    int create_notification(const string& topic_name, const rgw::notify::EventTypeList& events);
-    int create_notification(const string& topic_name, const rgw::notify::EventTypeList& events, OptionalFilter s3_filter, const std::string& notif_name);
+    int create_notification(const string& topic_name, const rgw::notify::EventTypeList& events, optional_yield y);
+    int create_notification(const string& topic_name, const rgw::notify::EventTypeList& events, OptionalFilter s3_filter, const std::string& notif_name, optional_yield y);
     // remove a topic and filter from bucket
     // if the topic does not exists on the bucket it is a no-op (considered success)
     // return -ENOENT if the topic does not exists
     // return 0 on success, error code otherwise
-    int remove_notification(const string& topic_name);
+    int remove_notification(const string& topic_name, optional_yield y);
   };
 
   // base class for subscription
@@ -668,8 +672,9 @@ public:
     rgw_raw_obj sub_meta_obj;
 
     int read_sub(rgw_pubsub_sub_config *result, RGWObjVersionTracker *objv_tracker);
-    int write_sub(const rgw_pubsub_sub_config& sub_conf, RGWObjVersionTracker *objv_tracker);
-    int remove_sub(RGWObjVersionTracker *objv_tracker);
+    int write_sub(const rgw_pubsub_sub_config& sub_conf,
+                 RGWObjVersionTracker *objv_tracker, optional_yield y);
+    int remove_sub(RGWObjVersionTracker *objv_tracker, optional_yield y);
   public:
     Sub(RGWUserPubSub *_ps, const std::string& _sub) : ps(_ps), sub(_sub) {
       ps->get_sub_meta_obj(sub, &sub_meta_obj);
@@ -677,8 +682,9 @@ public:
 
     virtual ~Sub() = default;
 
-    int subscribe(const string& topic_name, const rgw_pubsub_sub_dest& dest, const std::string& s3_id="");
-    int unsubscribe(const string& topic_name);
+    int subscribe(const string& topic_name, const rgw_pubsub_sub_dest& dest, optional_yield y,
+                 const std::string& s3_id="");
+    int unsubscribe(const string& topic_name, optional_yield y);
     int get_conf(rgw_pubsub_sub_config* result);
     
     static const int DEFAULT_MAX_EVENTS = 100;
@@ -751,15 +757,15 @@ public:
   // create a topic with a name only
   // if the topic already exists it is a no-op (considered success)
   // return 0 on success, error code otherwise
-  int create_topic(const string& name);
+  int create_topic(const string& name, optional_yield y);
   // create a topic with push destination information and ARN
   // if the topic already exists the destination and ARN values may be updated (considered succsess)
   // return 0 on success, error code otherwise
-  int create_topic(const string& name, const rgw_pubsub_sub_dest& dest, const std::string& arn, const std::string& opaque_data);
+  int create_topic(const string& name, const rgw_pubsub_sub_dest& dest, const std::string& arn, const std::string& opaque_data, optional_yield y);
   // remove a topic according to its name
   // if the topic does not exists it is a no-op (considered success)
   // return 0 on success, error code otherwise
-  int remove_topic(const string& name);
+  int remove_topic(const string& name, optional_yield y);
 };
 
 
@@ -787,14 +793,15 @@ int RGWUserPubSub::read(const rgw_raw_obj& obj, T *result, RGWObjVersionTracker
 }
 
 template <class T>
-int RGWUserPubSub::write(const rgw_raw_obj& obj, const T& info, RGWObjVersionTracker *objv_tracker)
+int RGWUserPubSub::write(const rgw_raw_obj& obj, const T& info,
+                        RGWObjVersionTracker *objv_tracker, optional_yield y)
 {
   bufferlist bl;
   encode(info, bl);
 
   int ret = rgw_put_system_obj(obj_ctx, obj.pool, obj.oid,
-                           bl, false, objv_tracker,
-                           real_time());
+                              bl, false, objv_tracker,
+                              real_time(), y);
   if (ret < 0) {
     return ret;
   }
index 4ab5c420c2bb26cc111d8759dbb4e21c0e0e042c..6e619033f7607c19e5aad509373d6129d20dff2c 100644 (file)
@@ -123,7 +123,7 @@ void RGWCreateOIDCProvider::execute(optional_yield y)
 
   RGWOIDCProvider provider(s->cct, store->getRados()->pctl, provider_url,
                             s->user->get_tenant(), client_ids, thumbprints);
-  op_ret = provider.create(true);
+  op_ret = provider.create(true, y);
 
   if (op_ret == 0) {
     s->formatter->open_object_section("CreateOpenIDConnectProviderResponse");
@@ -141,8 +141,8 @@ void RGWCreateOIDCProvider::execute(optional_yield y)
 void RGWDeleteOIDCProvider::execute(optional_yield y)
 {
   RGWOIDCProvider provider(s->cct, store->getRados()->pctl, provider_arn, s->user->get_tenant());
-  op_ret = provider.delete_obj();
-  
+  op_ret = provider.delete_obj(y);
+
   if (op_ret < 0 && op_ret != -ENOENT && op_ret != -EINVAL) {
     op_ret = ERR_INTERNAL_ERROR;
   }
index 58d2d8452b152f283bf619f80ad94447fb8327ca..d6de68c2cf16c15d22a25e6d605c0abdac775399 100644 (file)
@@ -514,7 +514,7 @@ void RGWPSCreateNotif_ObjStore_S3::execute(optional_yield y) {
     // generate the internal topic. destination is stored here for the "push-only" case
     // when no subscription exists
     // ARN is cached to make the "GET" method faster
-    op_ret = ups->create_topic(unique_topic_name, topic_info.dest, topic_info.arn, topic_info.opaque_data);
+    op_ret = ups->create_topic(unique_topic_name, topic_info.dest, topic_info.arn, topic_info.opaque_data, y);
     if (op_ret < 0) {
       ldout(s->cct, 1) << "failed to auto-generate unique topic '" << unique_topic_name << 
         "', ret=" << op_ret << dendl;
@@ -523,12 +523,12 @@ void RGWPSCreateNotif_ObjStore_S3::execute(optional_yield y) {
     ldout(s->cct, 20) << "successfully auto-generated unique topic '" << unique_topic_name << "'" << dendl;
     // generate the notification
     rgw::notify::EventTypeList events;
-    op_ret = b->create_notification(unique_topic_name, c.events, std::make_optional(c.filter), notif_name);
+    op_ret = b->create_notification(unique_topic_name, c.events, std::make_optional(c.filter), notif_name, y);
     if (op_ret < 0) {
       ldout(s->cct, 1) << "failed to auto-generate notification for unique topic '" << unique_topic_name <<
         "', ret=" << op_ret << dendl;
       // rollback generated topic (ignore return value)
-      ups->remove_topic(unique_topic_name);
+      ups->remove_topic(unique_topic_name, y);
       return;
     }
     ldout(s->cct, 20) << "successfully auto-generated notification for unique topic '" << unique_topic_name << "'" << dendl;
@@ -539,13 +539,13 @@ void RGWPSCreateNotif_ObjStore_S3::execute(optional_yield y) {
       dest.bucket_name = data_bucket_prefix + s->owner.get_id().to_str() + "-" + unique_topic_name;
       dest.oid_prefix = data_oid_prefix + notif_name + "/";
       auto sub = ups->get_sub(notif_name);
-      op_ret = sub->subscribe(unique_topic_name, dest, notif_name);
+      op_ret = sub->subscribe(unique_topic_name, dest, y, notif_name);
       if (op_ret < 0) {
         ldout(s->cct, 1) << "failed to auto-generate subscription '" << notif_name << "', ret=" << op_ret << dendl;
         // rollback generated notification (ignore return value)
-        b->remove_notification(unique_topic_name);
+        b->remove_notification(unique_topic_name, y);
         // rollback generated topic (ignore return value)
-        ups->remove_topic(unique_topic_name);
+        ups->remove_topic(unique_topic_name, y);
         return;
       }
       ldout(s->cct, 20) << "successfully auto-generated subscription '" << notif_name << "'" << dendl;
@@ -573,12 +573,12 @@ private:
     return 0;
   }
 
-  void remove_notification_by_topic(const std::string& topic_name, const RGWUserPubSub::BucketRef& b) {
-    op_ret = b->remove_notification(topic_name);
+  void remove_notification_by_topic(const std::string& topic_name, const RGWUserPubSub::BucketRef& b, optional_yield y) {
+    op_ret = b->remove_notification(topic_name, y);
     if (op_ret < 0) {
       ldout(s->cct, 1) << "failed to remove notification of topic '" << topic_name << "', ret=" << op_ret << dendl;
     }
-    op_ret = ups->remove_topic(topic_name);
+    op_ret = ups->remove_topic(topic_name, y);
     if (op_ret < 0) {
       ldout(s->cct, 1) << "failed to remove auto-generated topic '" << topic_name << "', ret=" << op_ret << dendl;
     }
@@ -614,12 +614,12 @@ void RGWPSDeleteNotif_ObjStore_S3::execute(optional_yield y) {
       // remove the auto generated subscription according to notification name (if exist)
       const auto unique_topic_name = unique_topic->get().topic.name;
       auto sub = ups->get_sub(notif_name);
-      op_ret = sub->unsubscribe(unique_topic_name);
+      op_ret = sub->unsubscribe(unique_topic_name, y);
       if (op_ret < 0 && op_ret != -ENOENT) {
         ldout(s->cct, 1) << "failed to remove auto-generated subscription '" << notif_name << "', ret=" << op_ret << dendl;
         return;
       }
-      remove_notification_by_topic(unique_topic_name, b);
+      remove_notification_by_topic(unique_topic_name, b, y);
       return;
     }
     // notification to be removed is not found - considered success
@@ -643,14 +643,14 @@ void RGWPSDeleteNotif_ObjStore_S3::execute(optional_yield y) {
       if (!sub_conf.s3_id.empty()) {
         // S3 notification, has autogenerated subscription
         const auto& sub_topic_name = sub_conf.topic;
-        op_ret = sub->unsubscribe(sub_topic_name);
+        op_ret = sub->unsubscribe(sub_topic_name, y);
         if (op_ret < 0) {
           ldout(s->cct, 1) << "failed to remove auto-generated subscription '" << topic_sub_name << "', ret=" << op_ret << dendl;
           return;
         }
       }
     }
-    remove_notification_by_topic(topic.first, b);
+    remove_notification_by_topic(topic.first, b, y);
   }
 }
 
index 93f208c2bab3becf8935ac472c02f39ac25b3523..3b7d71828dbd69d3608d1a51f395191840a1337e 100644 (file)
@@ -46,6 +46,7 @@ bool topics_has_endpoint_secret(const rgw_pubsub_user_topics& topics) {
     }
     return false;
 }
+
 void RGWPSCreateTopicOp::execute(optional_yield y) {
   op_ret = get_params();
   if (op_ret < 0) {
@@ -53,7 +54,7 @@ void RGWPSCreateTopicOp::execute(optional_yield y) {
   }
 
   ups.emplace(store, s->owner.get_id());
-  op_ret = ups->create_topic(topic_name, dest, topic_arn, opaque_data);
+  op_ret = ups->create_topic(topic_name, dest, topic_arn, opaque_data, y);
   if (op_ret < 0) {
     ldout(s->cct, 1) << "failed to create topic '" << topic_name << "', ret=" << op_ret << dendl;
     return;
@@ -103,7 +104,7 @@ void RGWPSDeleteTopicOp::execute(optional_yield y) {
     return;
   }
   ups.emplace(store, s->owner.get_id());
-  op_ret = ups->remove_topic(topic_name);
+  op_ret = ups->remove_topic(topic_name, y);
   if (op_ret < 0) {
     ldout(s->cct, 1) << "failed to remove topic '" << topic_name << ", ret=" << op_ret << dendl;
     return;
@@ -118,7 +119,7 @@ void RGWPSCreateSubOp::execute(optional_yield y) {
   }
   ups.emplace(store, s->owner.get_id());
   auto sub = ups->get_sub(sub_name);
-  op_ret = sub->subscribe(topic_name, dest);
+  op_ret = sub->subscribe(topic_name, dest, y);
   if (op_ret < 0) {
     ldout(s->cct, 1) << "failed to create subscription '" << sub_name << "', ret=" << op_ret << dendl;
     return;
@@ -153,7 +154,7 @@ void RGWPSDeleteSubOp::execute(optional_yield y) {
   }
   ups.emplace(store, s->owner.get_id());
   auto sub = ups->get_sub(sub_name);
-  op_ret = sub->unsubscribe(topic_name);
+  op_ret = sub->unsubscribe(topic_name, y);
   if (op_ret < 0) {
     ldout(s->cct, 1) << "failed to remove subscription '" << sub_name << "', ret=" << op_ret << dendl;
     return;
index 6f6df30225bc36aa79d8807903b0e22f4e28ee34..d64f44c28180188f2a77a44049a29e8e9f08e558 100644 (file)
@@ -132,7 +132,7 @@ void RGWCreateRole::execute(optional_yield y)
   }
   RGWRole role(s->cct, store->getRados()->pctl, role_name, role_path, trust_policy,
                 s->user->get_tenant(), max_session_duration);
-  op_ret = role.create(true);
+  op_ret = role.create(true, y);
 
   if (op_ret == -EEXIST) {
     op_ret = -ERR_ROLE_EXISTS;
@@ -171,7 +171,7 @@ void RGWDeleteRole::execute(optional_yield y)
     return;
   }
 
-  op_ret = _role.delete_obj();
+  op_ret = _role.delete_obj(y);
 
   if (op_ret == -ENOENT) {
     op_ret = -ERR_NO_ROLE_FOUND;
@@ -279,7 +279,7 @@ void RGWModifyRole::execute(optional_yield y)
   }
 
   _role.update_trust_policy(trust_policy);
-  op_ret = _role.update();
+  op_ret = _role.update(y);
 
   s->formatter->open_object_section("UpdateAssumeRolePolicyResponse");
   s->formatter->open_object_section("ResponseMetadata");
@@ -371,7 +371,7 @@ void RGWPutRolePolicy::execute(optional_yield y)
   }
 
   _role.set_perm_policy(policy_name, perm_policy);
-  op_ret = _role.update();
+  op_ret = _role.update(y);
 
   if (op_ret == 0) {
     s->formatter->open_object_section("PutRolePolicyResponse");
@@ -479,7 +479,7 @@ void RGWDeleteRolePolicy::execute(optional_yield y)
   }
 
   if (op_ret == 0) {
-    op_ret = _role.update();
+    op_ret = _role.update(y);
   }
 
   s->formatter->open_object_section("DeleteRolePoliciesResponse");
index a5d18ae00686a0b0eb8c879a5ce4f29e080e9b32..862b1d2b7eb39bcfe11dc231ca91fefa29ffe0c8 100644 (file)
@@ -30,7 +30,7 @@ const string RGWRole::role_oid_prefix = "roles.";
 const string RGWRole::role_path_oid_prefix = "role_paths.";
 const string RGWRole::role_arn_prefix = "arn:aws:iam::";
 
-int RGWRole::store_info(bool exclusive)
+int RGWRole::store_info(bool exclusive, optional_yield y)
 {
   using ceph::encode;
   string oid = get_info_oid_prefix() + id;
@@ -42,10 +42,10 @@ int RGWRole::store_info(bool exclusive)
 
   auto obj_ctx = ctl->svc->sysobj->init_obj_ctx();
   return rgw_put_system_obj(obj_ctx, svc->zone->get_zone_params().roles_pool, oid,
-                            bl, exclusive, NULL, real_time(), NULL);
+                            bl, exclusive, NULL, real_time(), y, NULL);
 }
 
-int RGWRole::store_name(bool exclusive)
+int RGWRole::store_name(bool exclusive, optional_yield y)
 {
   RGWNameToId nameToId;
   nameToId.obj_id = id;
@@ -60,10 +60,10 @@ int RGWRole::store_name(bool exclusive)
 
   auto obj_ctx = svc->sysobj->init_obj_ctx();
   return rgw_put_system_obj(obj_ctx, svc->zone->get_zone_params().roles_pool, oid,
-              bl, exclusive, NULL, real_time(), NULL);
+                           bl, exclusive, NULL, real_time(), y, NULL);
 }
 
-int RGWRole::store_path(bool exclusive)
+int RGWRole::store_path(bool exclusive, optional_yield y)
 {
   string oid = tenant + get_path_oid_prefix() + path + get_info_oid_prefix() + id;
 
@@ -72,10 +72,10 @@ int RGWRole::store_path(bool exclusive)
   bufferlist bl;
   auto obj_ctx = svc->sysobj->init_obj_ctx();
   return rgw_put_system_obj(obj_ctx, svc->zone->get_zone_params().roles_pool, oid,
-              bl, exclusive, NULL, real_time(), NULL);
+                           bl, exclusive, NULL, real_time(), y, NULL);
 }
 
-int RGWRole::create(bool exclusive)
+int RGWRole::create(bool exclusive, optional_yield y)
 {
   int ret;
 
@@ -121,21 +121,21 @@ int RGWRole::create(bool exclusive)
   auto svc = ctl->svc;
 
   auto& pool = svc->zone->get_zone_params().roles_pool;
-  ret = store_info(exclusive);
+  ret = store_info(exclusive, y);
   if (ret < 0) {
     ldout(cct, 0) << "ERROR:  storing role info in pool: " << pool.name << ": "
                   << id << ": " << cpp_strerror(-ret) << dendl;
     return ret;
   }
 
-  ret = store_name(exclusive);
+  ret = store_name(exclusive, y);
   if (ret < 0) {
     ldout(cct, 0) << "ERROR: storing role name in pool: " << pool.name << ": "
                   << name << ": " << cpp_strerror(-ret) << dendl;
 
     //Delete the role info that was stored in the previous call
     string oid = get_info_oid_prefix() + id;
-    int info_ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL);
+    int info_ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL, y);
     if (info_ret < 0) {
       ldout(cct, 0) << "ERROR: cleanup of role id from pool: " << pool.name << ": "
                   << id << ": " << cpp_strerror(-info_ret) << dendl;
@@ -143,20 +143,20 @@ int RGWRole::create(bool exclusive)
     return ret;
   }
 
-  ret = store_path(exclusive);
+  ret = store_path(exclusive, y);
   if (ret < 0) {
     ldout(cct, 0) << "ERROR: storing role path in pool: " << pool.name << ": "
                   << path << ": " << cpp_strerror(-ret) << dendl;
     //Delete the role info that was stored in the previous call
     string oid = get_info_oid_prefix() + id;
-    int info_ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL);
+    int info_ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL, y);
     if (info_ret < 0) {
       ldout(cct, 0) << "ERROR: cleanup of role id from pool: " << pool.name << ": "
                   << id << ": " << cpp_strerror(-info_ret) << dendl;
     }
     //Delete role name that was stored in previous call
     oid = tenant + get_names_oid_prefix() + name;
-    int name_ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL);
+    int name_ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL, y);
     if (name_ret < 0) {
       ldout(cct, 0) << "ERROR: cleanup of role name from pool: " << pool.name << ": "
                   << name << ": " << cpp_strerror(-name_ret) << dendl;
@@ -166,7 +166,7 @@ int RGWRole::create(bool exclusive)
   return 0;
 }
 
-int RGWRole::delete_obj()
+int RGWRole::delete_obj(optional_yield y)
 {
   auto svc = ctl->svc;
   auto& pool = svc->zone->get_zone_params().roles_pool;
@@ -187,7 +187,7 @@ int RGWRole::delete_obj()
 
   // Delete id
   string oid = get_info_oid_prefix() + id;
-  ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL);
+  ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL, y);
   if (ret < 0) {
     ldout(cct, 0) << "ERROR: deleting role id from pool: " << pool.name << ": "
                   << id << ": " << cpp_strerror(-ret) << dendl;
@@ -195,7 +195,7 @@ int RGWRole::delete_obj()
 
   // Delete name
   oid = tenant + get_names_oid_prefix() + name;
-  ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL);
+  ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL, y);
   if (ret < 0) {
     ldout(cct, 0) << "ERROR: deleting role name from pool: " << pool.name << ": "
                   << name << ": " << cpp_strerror(-ret) << dendl;
@@ -203,7 +203,7 @@ int RGWRole::delete_obj()
 
   // Delete path
   oid = tenant + get_path_oid_prefix() + path + get_info_oid_prefix() + id;
-  ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL);
+  ret = rgw_delete_system_obj(svc->sysobj, pool, oid, NULL, y);
   if (ret < 0) {
     ldout(cct, 0) << "ERROR: deleting role path from pool: " << pool.name << ": "
                   << path << ": " << cpp_strerror(-ret) << dendl;
@@ -236,11 +236,11 @@ int RGWRole::get_by_id()
   return 0;
 }
 
-int RGWRole::update()
+int RGWRole::update(optional_yield y)
 {
   auto& pool = ctl->svc->zone->get_zone_params().roles_pool;
 
-  int ret = store_info(false);
+  int ret = store_info(false, y);
   if (ret < 0) {
     ldout(cct, 0) << "ERROR:  storing info in pool: " << pool.name << ": "
                   << id << ": " << cpp_strerror(-ret) << dendl;
index 41484f0d4e10ca82e60162856fd2fe4257ec7cd2..02f4ec8374103404579b8b9b7aea0a4eaaf3611f 100644 (file)
@@ -6,9 +6,13 @@
 
 #include <string>
 
+#include "common/async/yield_context.h"
+
 #include "common/ceph_json.h"
 #include "common/ceph_context.h"
 
+#include "rgw/rgw_rados.h"
+
 class RGWCtl;
 
 class RGWRole
@@ -35,9 +39,9 @@ class RGWRole
   string tenant;
   uint64_t max_session_duration;
 
-  int store_info(bool exclusive);
-  int store_name(bool exclusive);
-  int store_path(bool exclusive);
+  int store_info(bool exclusive, optional_yield y);
+  int store_name(bool exclusive, optional_yield y);
+  int store_path(bool exclusive, optional_yield y);
   int read_id(const string& role_name, const string& tenant, string& role_id);
   int read_name();
   int read_info();
@@ -137,11 +141,11 @@ public:
 
   void set_id(const string& id) { this->id = id; }
 
-  int create(bool exclusive);
-  int delete_obj();
+  int create(bool exclusive, optional_yield y);
+  int delete_obj(optional_yield y);
   int get();
   int get_by_id();
-  int update();
+  int update(optional_yield y);
   void update_trust_policy(string& trust_policy);
   void set_perm_policy(const string& policy_name, const string& perm_policy);
   vector<string> get_role_policy_names();
@@ -161,4 +165,3 @@ public:
 };
 WRITE_CLASS_ENCODER(RGWRole)
 #endif /* CEPH_RGW_ROLE_H */
-
index 01182d211be2313e7b920f4f771b00426884ef7e..2326e958a0ae304dedcd877c5e8e34cceaf9286f 100644 (file)
@@ -377,7 +377,7 @@ void RGWPSCreateNotif_ObjStore::execute(optional_yield y)
   ups.emplace(store, s->owner.get_id());
 
   auto b = ups->get_bucket(bucket_info.bucket);
-  op_ret = b->create_notification(topic_name, events);
+  op_ret = b->create_notification(topic_name, events, y);
   if (op_ret < 0) {
     ldout(s->cct, 1) << "failed to create notification for topic '" << topic_name << "', ret=" << op_ret << dendl;
     return;
@@ -413,7 +413,7 @@ void RGWPSDeleteNotif_ObjStore::execute(optional_yield y) {
 
   ups.emplace(store, s->owner.get_id());
   auto b = ups->get_bucket(bucket_info.bucket);
-  op_ret = b->remove_notification(topic_name);
+  op_ret = b->remove_notification(topic_name, y);
   if (op_ret < 0) {
     ldout(s->cct, 1) << "failed to remove notification from topic '" << topic_name << "', ret=" << op_ret << dendl;
     return;
index 5b2d2579147448f5d18f9d3682e11aa8b4ae9a77..09074929b33d811dd6434a4c5908c03f1d640f98 100644 (file)
@@ -174,13 +174,6 @@ int rgw_put_system_obj(RGWSysObjectCtx& obj_ctx, const rgw_pool& pool, const str
   return ret;
 }
 
-int rgw_put_system_obj(RGWSysObjectCtx& obj_ctx, const rgw_pool& pool, const string& oid, bufferlist& data, bool exclusive,
-                       RGWObjVersionTracker *objv_tracker, real_time set_mtime, map<string, bufferlist> *pattrs)
-{
-  return rgw_put_system_obj(obj_ctx, pool, oid, data, exclusive,
-                            objv_tracker, set_mtime, null_yield, pattrs);
-}
-
 int rgw_get_system_obj(RGWSysObjectCtx& obj_ctx, const rgw_pool& pool, const string& key, bufferlist& bl,
                        RGWObjVersionTracker *objv_tracker, real_time *pmtime, optional_yield y, map<string, bufferlist> *pattrs,
                        rgw_cache_entry_info *cache_info,
@@ -234,14 +227,14 @@ int rgw_get_system_obj(RGWSysObjectCtx& obj_ctx, const rgw_pool& pool, const str
 }
 
 int rgw_delete_system_obj(RGWSI_SysObj *sysobj_svc, const rgw_pool& pool, const string& oid,
-                          RGWObjVersionTracker *objv_tracker)
+                          RGWObjVersionTracker *objv_tracker, optional_yield y)
 {
   auto obj_ctx = sysobj_svc->init_obj_ctx();
   auto sysobj = obj_ctx.get_obj(rgw_raw_obj{pool, oid});
   rgw_raw_obj obj(pool, oid);
   return sysobj.wop()
                .set_objv_tracker(objv_tracker)
-               .remove(null_yield);
+               .remove(y);
 }
 
 thread_local bool is_asio_thread = false;
@@ -437,13 +430,13 @@ int RGWDataAccess::Bucket::finish_init()
   return 0;
 }
 
-int RGWDataAccess::Bucket::init()
+int RGWDataAccess::Bucket::init(optional_yield y)
 {
   int ret = sd->store->getRados()->get_bucket_info(sd->store->svc(),
                                       tenant, name,
                                       bucket_info,
                                       &mtime,
-                                       null_yield,
+                                       y,
                                       &attrs);
   if (ret < 0) {
     return ret;
index d49f39efa6eb9558fefad0c7f831482931bf4964..28d251c28d6c69a0d24d235551551f0ab7679125 100644 (file)
@@ -38,7 +38,7 @@ int rgw_init_ioctx(librados::Rados *rados, const rgw_pool& pool,
 
 extern const std::string MP_META_SUFFIX;
 
-static inline int rgw_shards_max()
+inline int rgw_shards_max()
 {
   return RGW_SHARDS_PRIME_1;
 }
@@ -53,7 +53,7 @@ static inline int rgw_shards_mod(unsigned hval, int max_shards)
 }
 
 // used for logging and tagging
-static inline int rgw_shard_id(const string& key, int max_shards)
+inline int rgw_shard_id(const string& key, int max_shards)
 {
   return rgw_shards_mod(ceph_str_hash_linux(key.c_str(), key.size()),
                        max_shards);
@@ -71,8 +71,6 @@ struct rgw_name_to_flag {
 int rgw_parse_list_of_flags(struct rgw_name_to_flag *mapping,
                            const string& str, uint32_t *perm);
 
-int rgw_put_system_obj(RGWSysObjectCtx& obj_ctx, const rgw_pool& pool, const string& oid, bufferlist& data, bool exclusive,
-                       RGWObjVersionTracker *objv_tracker, real_time set_mtime, map<string, bufferlist> *pattrs = NULL);
 int rgw_put_system_obj(RGWSysObjectCtx& obj_ctx, const rgw_pool& pool, const string& oid, bufferlist& data, bool exclusive,
                        RGWObjVersionTracker *objv_tracker, real_time set_mtime, optional_yield y, map<string, bufferlist> *pattrs = NULL);
 int rgw_get_system_obj(RGWSysObjectCtx& obj_ctx, const rgw_pool& pool, const string& key, bufferlist& bl,
@@ -80,7 +78,7 @@ int rgw_get_system_obj(RGWSysObjectCtx& obj_ctx, const rgw_pool& pool, const str
                        rgw_cache_entry_info *cache_info = NULL,
                       boost::optional<obj_version> refresh_version = boost::none);
 int rgw_delete_system_obj(RGWSI_SysObj *sysobj_svc, const rgw_pool& pool, const string& oid,
-                          RGWObjVersionTracker *objv_tracker);
+                          RGWObjVersionTracker *objv_tracker, optional_yield y);
 
 const char *rgw_find_mime_by_ext(string& ext);
 
@@ -179,7 +177,7 @@ public:
                                        name(_name),
                                       bucket_id(_bucket_id) {}
     Bucket(RGWDataAccess *_sd) : sd(_sd) {}
-    int init();
+    int init(optional_yield y);
     int init(const RGWBucketInfo& _bucket_info, const map<string, bufferlist>& _attrs);
   public:
     int get_object(const rgw_obj_key& key,
@@ -237,9 +235,10 @@ public:
   int get_bucket(const string& tenant,
                 const string name,
                 const string bucket_id,
-                BucketRef *bucket) {
+                BucketRef *bucket,
+                optional_yield y) {
     bucket->reset(new Bucket(this, tenant, name, bucket_id));
-    return (*bucket)->init();
+    return (*bucket)->init(y);
   }
 
   int get_bucket(const RGWBucketInfo& bucket_info,
index 8e26c12cebf5960ce9f5eb9708cbb1775d53eeb2..cbc729ecfb796fd7db50b8fffe383075e4806190 100644 (file)
@@ -92,7 +92,7 @@ int RGWSI_MDLog::read_history(RGWMetadataLogHistory *state,
 
 int RGWSI_MDLog::write_history(const RGWMetadataLogHistory& state,
                                RGWObjVersionTracker *objv_tracker,
-                               bool exclusive)
+                               optional_yield y, bool exclusive)
 {
   bufferlist bl;
   state.encode(bl);
@@ -101,7 +101,7 @@ int RGWSI_MDLog::write_history(const RGWMetadataLogHistory& state,
   const auto& oid = RGWMetadataLogHistory::oid;
   auto obj_ctx = svc.sysobj->init_obj_ctx();
   return rgw_put_system_obj(obj_ctx, pool, oid, bl,
-                            exclusive, objv_tracker, real_time{});
+                            exclusive, objv_tracker, real_time{}, y);
 }
 
 namespace mdlog {
@@ -296,7 +296,7 @@ Cursor RGWSI_MDLog::init_oldest_log_period(optional_yield y)
     state.oldest_period_id = cursor.get_period().get_id();
 
     constexpr bool exclusive = true; // don't overwrite
-    int ret = write_history(state, &objv, exclusive);
+    int ret = write_history(state, &objv, y, exclusive);
     if (ret < 0 && ret != -EEXIST) {
       ldout(cct, 1) << "failed to write mdlog history: "
           << cpp_strerror(ret) << dendl;
@@ -318,7 +318,7 @@ Cursor RGWSI_MDLog::init_oldest_log_period(optional_yield y)
     state.oldest_realm_epoch = cursor.get_epoch();
     state.oldest_period_id = cursor.get_period().get_id();
     ldout(cct, 10) << "rewriting mdlog history" << dendl;
-    ret = write_history(state, &objv);
+    ret = write_history(state, &objv, y);
     if (ret < 0 && ret != -ECANCELED) {
     ldout(cct, 1) << "failed to write mdlog history: "
           << cpp_strerror(ret) << dendl;
index d578664ab9bc03741172eb6983185f493b767b89..da15e4b9873084ad3384d5c85a46b1872478b3c0 100644 (file)
@@ -97,7 +97,7 @@ public:
   int read_history(RGWMetadataLogHistory *state, RGWObjVersionTracker *objv_tracker,optional_yield y) const;
   int write_history(const RGWMetadataLogHistory& state,
                     RGWObjVersionTracker *objv_tracker,
-                    bool exclusive = false);
+                   optional_yield y, bool exclusive = false);
 
   int add_entry(const string& hash_key, const string& section, const string& key, bufferlist& bl);