]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: No null_yield in rgw_zone
authorAdam C. Emerson <aemerson@redhat.com>
Wed, 11 Nov 2020 14:36:23 +0000 (09:36 -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>
20 files changed:
src/rgw/rgw_admin.cc
src/rgw/rgw_main.cc
src/rgw/rgw_period_history.cc
src/rgw/rgw_period_history.h
src/rgw/rgw_period_puller.cc
src/rgw/rgw_period_puller.h
src/rgw/rgw_period_pusher.cc
src/rgw/rgw_period_pusher.h
src/rgw/rgw_rados.cc
src/rgw/rgw_rest_config.cc
src/rgw/rgw_rest_realm.cc
src/rgw/rgw_sync.cc
src/rgw/rgw_sync.h
src/rgw/rgw_zone.cc
src/rgw/rgw_zone.h
src/rgw/services/svc_mdlog.cc
src/rgw/services/svc_mdlog.h
src/rgw/services/svc_zone.cc
src/rgw/services/svc_zone.h
src/test/rgw/test_rgw_period_history.cc

index 8d2a1b3efa72c5555602cd2832da279589878af2..36445e86aacde4647861fa559d1ec97716791cc7 100644 (file)
@@ -1642,14 +1642,16 @@ static int commit_period(RGWRealm& realm, RGWPeriod& period,
   if (store->svc()->zone->zone_id() == master_zone) {
     // read the current period
     RGWPeriod current_period;
-    int ret = current_period.init(g_ceph_context, store->svc()->sysobj, realm.get_id());
+    int ret = current_period.init(g_ceph_context,
+                                 store->svc()->sysobj, realm.get_id(),
+                                 null_yield);
     if (ret < 0) {
       cerr << "Error initializing current period: "
           << cpp_strerror(-ret) << std::endl;
       return ret;
     }
     // the master zone can commit locally
-    ret = period.commit(store, realm, current_period, cerr, force);
+    ret = period.commit(store, realm, current_period, cerr, null_yield, force);
     if (ret < 0) {
       cerr << "failed to commit period: " << cpp_strerror(-ret) << std::endl;
     }
@@ -1713,23 +1715,23 @@ static int commit_period(RGWRealm& realm, RGWPeriod& period,
   }
   // the master zone gave us back the period that it committed, so it's
   // safe to save it as our latest epoch
-  ret = period.store_info(false);
+  ret = period.store_info(false, null_yield);
   if (ret < 0) {
     cerr << "Error storing committed period " << period.get_id() << ": "
         << cpp_strerror(ret) << std::endl;
     return ret;
   }
-  ret = period.set_latest_epoch(period.get_epoch());
+  ret = period.set_latest_epoch(null_yield, period.get_epoch());
   if (ret < 0) {
     cerr << "Error updating period epoch: " << cpp_strerror(ret) << std::endl;
     return ret;
   }
-  ret = period.reflect();
+  ret = period.reflect(null_yield);
   if (ret < 0) {
     cerr << "Error updating local objects: " << cpp_strerror(ret) << std::endl;
     return ret;
   }
-  realm.notify_new_period(period);
+  realm.notify_new_period(period, null_yield);
   return ret;
 }
 
@@ -1740,7 +1742,7 @@ static int update_period(const string& realm_id, const string& realm_name,
                          Formatter *formatter, bool force)
 {
   RGWRealm realm(realm_id, realm_name);
-  int ret = realm.init(g_ceph_context, store->svc()->sysobj);
+  int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
   if (ret < 0 ) {
     cerr << "Error initializing realm " << cpp_strerror(-ret) << std::endl;
     return ret;
@@ -1750,19 +1752,19 @@ static int update_period(const string& realm_id, const string& realm_name,
     epoch = atoi(period_epoch.c_str());
   }
   RGWPeriod period(period_id, epoch);
-  ret = period.init(g_ceph_context, store->svc()->sysobj, realm.get_id());
+  ret = period.init(g_ceph_context, store->svc()->sysobj, realm.get_id(), null_yield);
   if (ret < 0) {
     cerr << "period init failed: " << cpp_strerror(-ret) << std::endl;
     return ret;
   }
   period.fork();
-  ret = period.update();
+  ret = period.update(null_yield);
   if(ret < 0) {
     // Dropping the error message here, as both the ret codes were handled in
     // period.update()
     return ret;
   }
-  ret = period.store_info(false);
+  ret = period.store_info(false, null_yield);
   if (ret < 0) {
     cerr << "failed to store period: " << cpp_strerror(-ret) << std::endl;
     return ret;
@@ -1822,7 +1824,7 @@ static int do_period_pull(RGWRESTConn *remote_conn, const string& url,
     cerr << "request failed: " << cpp_strerror(-ret) << std::endl;
     return ret;
   }
-  ret = period->init(g_ceph_context, store->svc()->sysobj, false);
+  ret = period->init(g_ceph_context, store->svc()->sysobj, null_yield, false);
   if (ret < 0) {
     cerr << "faile to init period " << cpp_strerror(-ret) << std::endl;
     return ret;
@@ -1833,12 +1835,12 @@ static int do_period_pull(RGWRESTConn *remote_conn, const string& url,
     cout << "failed to decode JSON input: " << e.what() << std::endl;
     return -EINVAL;
   }
-  ret = period->store_info(false);
+  ret = period->store_info(false, null_yield);
   if (ret < 0) {
     cerr << "Error storing period " << period->get_id() << ": " << cpp_strerror(ret) << std::endl;
   }
   // store latest epoch (ignore errors)
-  period->update_latest_epoch(period->get_epoch());
+  period->update_latest_epoch(period->get_epoch(), null_yield);
   return 0;
 }
 
@@ -1847,7 +1849,7 @@ static int read_current_period_id(rgw::sal::RGWRadosStore* store, const std::str
                                   std::string* period_id)
 {
   RGWRealm realm(realm_id, realm_name);
-  int ret = realm.init(g_ceph_context, store->svc()->sysobj);
+  int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
   if (ret < 0) {
     std::cerr << "failed to read realm: " << cpp_strerror(-ret) << std::endl;
     return ret;
@@ -2866,7 +2868,7 @@ public:
                                                          bucket(_bucket) {}
 
   int init() {
-    int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+    int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
     if (ret < 0) {
       cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
       return ret;
@@ -2897,7 +2899,7 @@ public:
 
   int write_policy() {
     if (!bucket) {
-      int ret = zonegroup.update();
+      int ret = zonegroup.update(null_yield);
       if (ret < 0) {
         cerr << "failed to update zonegroup: " << cpp_strerror(-ret) << std::endl;
         return -ret;
@@ -3900,12 +3902,12 @@ int main(int argc, const char **argv)
          return EINVAL;
        }
        RGWPeriod period(period_id);
-       int ret = period.init(g_ceph_context, store->svc()->sysobj);
+       int ret = period.init(g_ceph_context, store->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "period.init failed: " << cpp_strerror(-ret) << std::endl;
          return -ret;
        }
-       ret = period.delete_obj();
+       ret = period.delete_obj(null_yield);
        if (ret < 0) {
          cerr << "ERROR: couldn't delete period: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -3921,7 +3923,7 @@ int main(int argc, const char **argv)
        }
         if (staging) {
           RGWRealm realm(realm_id, realm_name);
-          int ret = realm.init(g_ceph_context, store->svc()->sysobj);
+          int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
           if (ret < 0 ) {
             cerr << "Error initializing realm " << cpp_strerror(-ret) << std::endl;
             return -ret;
@@ -3932,7 +3934,8 @@ int main(int argc, const char **argv)
           epoch = 1;
         }
        RGWPeriod period(period_id, epoch);
-       int ret = period.init(g_ceph_context, store->svc()->sysobj, realm_id, realm_name);
+       int ret = period.init(g_ceph_context, store->svc()->sysobj, realm_id,
+                             null_yield, realm_name);
        if (ret < 0) {
          cerr << "period init failed: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -3984,13 +3987,13 @@ int main(int argc, const char **argv)
         if (url.empty()) {
           // load current period for endpoints
           RGWRealm realm(realm_id, realm_name);
-          int ret = realm.init(g_ceph_context, store->svc()->sysobj);
+          int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
           if (ret < 0) {
             cerr << "failed to init realm: " << cpp_strerror(-ret) << std::endl;
             return -ret;
           }
           RGWPeriod current_period(realm.get_current_period());
-          ret = current_period.init(g_ceph_context, store->svc()->sysobj);
+          ret = current_period.init(g_ceph_context, store->svc()->sysobj, null_yield);
           if (ret < 0) {
             cerr << "failed to init current period: " << cpp_strerror(-ret) << std::endl;
             return -ret;
@@ -4030,7 +4033,7 @@ int main(int argc, const char **argv)
           RGWRealm realm(g_ceph_context, store->svc()->sysobj);
           if (!realm_name.empty()) {
             // look up realm_id for the given realm_name
-            int ret = realm.read_id(realm_name, realm_id);
+            int ret = realm.read_id(realm_name, realm_id, null_yield);
             if (ret < 0) {
               cerr << "ERROR: failed to read realm for " << realm_name
                   << ": " << cpp_strerror(-ret) << std::endl;
@@ -4038,7 +4041,7 @@ int main(int argc, const char **argv)
             }
           } else {
             // use default realm_id when none is given
-            int ret = realm.read_default_id(realm_id);
+            int ret = realm.read_default_id(realm_id, null_yield);
             if (ret < 0 && ret != -ENOENT) { // on ENOENT, use empty realm_id
               cerr << "ERROR: failed to read default realm: "
                   << cpp_strerror(-ret) << std::endl;
@@ -4048,7 +4051,7 @@ int main(int argc, const char **argv)
         }
 
         RGWPeriodConfig period_config;
-        int ret = period_config.read(store->svc()->sysobj, realm_id);
+        int ret = period_config.read(store->svc()->sysobj, realm_id, null_yield);
         if (ret < 0 && ret != -ENOENT) {
           cerr << "ERROR: failed to read period config: "
               << cpp_strerror(-ret) << std::endl;
@@ -4079,7 +4082,7 @@ int main(int argc, const char **argv)
 
         if (opt_cmd != OPT::GLOBAL_QUOTA_GET) {
           // write the modified period config
-          ret = period_config.write(store->svc()->sysobj, realm_id);
+          ret = period_config.write(store->svc()->sysobj, realm_id, null_yield);
           if (ret < 0) {
             cerr << "ERROR: failed to write period config: "
                 << cpp_strerror(-ret) << std::endl;
@@ -4106,14 +4109,14 @@ int main(int argc, const char **argv)
        }
 
        RGWRealm realm(realm_name, g_ceph_context, store->svc()->sysobj);
-       int ret = realm.create();
+       int ret = realm.create(null_yield);
        if (ret < 0) {
          cerr << "ERROR: couldn't create realm " << realm_name << ": " << cpp_strerror(-ret) << std::endl;
          return -ret;
        }
 
         if (set_default) {
-          ret = realm.set_as_default();
+          ret = realm.set_as_default(null_yield);
           if (ret < 0) {
             cerr << "failed to set realm " << realm_name << " as default: " << cpp_strerror(-ret) << std::endl;
           }
@@ -4130,12 +4133,12 @@ int main(int argc, const char **argv)
          cerr << "missing realm name or id" << std::endl;
          return EINVAL;
        }
-       int ret = realm.init(g_ceph_context, store->svc()->sysobj);
+       int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "realm.init failed: " << cpp_strerror(-ret) << std::endl;
          return -ret;
        }
-       ret = realm.delete_obj();
+       ret = realm.delete_obj(null_yield);
        if (ret < 0) {
          cerr << "ERROR: couldn't : " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4146,7 +4149,7 @@ int main(int argc, const char **argv)
     case OPT::REALM_GET:
       {
        RGWRealm realm(realm_id, realm_name);
-       int ret = realm.init(g_ceph_context, store->svc()->sysobj);
+       int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
        if (ret < 0) {
          if (ret == -ENOENT && realm_name.empty() && realm_id.empty()) {
            cerr << "missing realm name or id, or default realm not found" << std::endl;
@@ -4163,7 +4166,7 @@ int main(int argc, const char **argv)
       {
        RGWRealm realm(g_ceph_context, store->svc()->sysobj);
        string default_id;
-       int ret = realm.read_default_id(default_id);
+       int ret = realm.read_default_id(default_id, null_yield);
        if (ret == -ENOENT) {
          cout << "No default realm is set" << std::endl;
          return -ret;
@@ -4178,7 +4181,7 @@ int main(int argc, const char **argv)
       {
        RGWRealm realm(g_ceph_context, store->svc()->sysobj);
        string default_id;
-       int ret = realm.read_default_id(default_id);
+       int ret = realm.read_default_id(default_id, null_yield);
        if (ret < 0 && ret != -ENOENT) {
          cerr << "could not determine default realm: " << cpp_strerror(-ret) << std::endl;
        }
@@ -4202,7 +4205,7 @@ int main(int argc, const char **argv)
          return -ret;
        }
        list<string> periods;
-       ret = store->svc()->zone->list_periods(period_id, periods);
+       ret = store->svc()->zone->list_periods(period_id, periods, null_yield);
        if (ret < 0) {
          cerr << "list periods failed: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4226,12 +4229,12 @@ int main(int argc, const char **argv)
          cerr << "missing realm name or id" << std::endl;
          return EINVAL;
        }
-       int ret = realm.init(g_ceph_context, store->svc()->sysobj);
+       int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "realm.init failed: " << cpp_strerror(-ret) << std::endl;
          return -ret;
        }
-       ret = realm.rename(realm_new_name);
+       ret = realm.rename(realm_new_name, null_yield);
        if (ret < 0) {
          cerr << "realm.rename failed: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4249,7 +4252,7 @@ int main(int argc, const char **argv)
        }
        RGWRealm realm(realm_id, realm_name);
        bool new_realm = false;
-       int ret = realm.init(g_ceph_context, store->svc()->sysobj);
+       int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
        if (ret < 0 && ret != -ENOENT) {
          cerr << "failed to init realm: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4269,13 +4272,13 @@ int main(int argc, const char **argv)
        if (new_realm) {
          cout << "clearing period and epoch for new realm" << std::endl;
          realm.clear_current_period_and_epoch();
-         ret = realm.create();
+         ret = realm.create(null_yield);
          if (ret < 0) {
            cerr << "ERROR: couldn't create new realm: " << cpp_strerror(-ret) << std::endl;
            return 1;
          }
        } else {
-         ret = realm.update();
+         ret = realm.update(null_yield);
          if (ret < 0) {
            cerr << "ERROR: couldn't store realm info: " << cpp_strerror(-ret) << std::endl;
            return 1;
@@ -4283,7 +4286,7 @@ int main(int argc, const char **argv)
        }
 
         if (set_default) {
-          ret = realm.set_as_default();
+          ret = realm.set_as_default(null_yield);
           if (ret < 0) {
             cerr << "failed to set realm " << realm_name << " as default: " << cpp_strerror(-ret) << std::endl;
           }
@@ -4296,12 +4299,12 @@ int main(int argc, const char **argv)
     case OPT::REALM_DEFAULT:
       {
        RGWRealm realm(realm_id, realm_name);
-       int ret = realm.init(g_ceph_context, store->svc()->sysobj);
+       int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "failed to init realm: " << cpp_strerror(-ret) << std::endl;
          return -ret;
        }
-       ret = realm.set_as_default();
+       ret = realm.set_as_default(null_yield);
        if (ret < 0) {
          cerr << "failed to set realm as default: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4338,7 +4341,7 @@ int main(int argc, const char **argv)
           return -ret;
         }
         RGWRealm realm;
-        realm.init(g_ceph_context, store->svc()->sysobj, false);
+        realm.init(g_ceph_context, store->svc()->sysobj, null_yield, false);
         try {
           decode_json_obj(realm, &p);
         } catch (const JSONDecoder::err& e) {
@@ -4357,13 +4360,13 @@ int main(int argc, const char **argv)
             return -ret;
           }
         }
-        ret = realm.create(false);
+        ret = realm.create(null_yield, false);
         if (ret < 0 && ret != -EEXIST) {
           cerr << "Error storing realm " << realm.get_id() << ": "
             << cpp_strerror(ret) << std::endl;
           return -ret;
         } else if (ret ==-EEXIST) {
-         ret = realm.update();
+         ret = realm.update(null_yield);
          if (ret < 0) {
            cerr << "Error storing realm " << realm.get_id() << ": "
                 << cpp_strerror(ret) << std::endl;
@@ -4371,7 +4374,7 @@ int main(int argc, const char **argv)
        }
 
         if (set_default) {
-          ret = realm.set_as_default();
+          ret = realm.set_as_default(null_yield);
           if (ret < 0) {
             cerr << "failed to set realm " << realm_name << " as default: " << cpp_strerror(-ret) << std::endl;
           }
@@ -4390,21 +4393,21 @@ int main(int argc, const char **argv)
        }
 
        RGWZoneGroup zonegroup(zonegroup_id,zonegroup_name);
-       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "failed to initialize zonegroup " << zonegroup_name << " id " << zonegroup_id << " :"
               << cpp_strerror(-ret) << std::endl;
          return -ret;
        }
        RGWZoneParams zone(zone_id, zone_name);
-       ret = zone.init(g_ceph_context, store->svc()->sysobj);
+       ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
          return -ret;
        }
         if (zone.realm_id != zonegroup.realm_id) {
           zone.realm_id = zonegroup.realm_id;
-          ret = zone.update();
+          ret = zone.update(null_yield);
           if (ret < 0) {
             cerr << "failed to save zone info: " << cpp_strerror(-ret) << std::endl;
             return -ret;
@@ -4430,7 +4433,8 @@ int main(int argc, const char **argv)
                                  endpoints, ptier_type,
                                  psync_from_all, sync_from, sync_from_rm,
                                  predirect_zone, bucket_index_max_shards,
-                                store->svc()->sync_modules->get_manager());
+                                store->svc()->sync_modules->get_manager(),
+                                null_yield);
        if (ret < 0) {
          cerr << "failed to add zone " << zone_name << " to zonegroup " << zonegroup.get_name() << ": "
               << cpp_strerror(-ret) << std::endl;
@@ -4448,7 +4452,7 @@ int main(int argc, const char **argv)
          return EINVAL;
        }
        RGWRealm realm(realm_id, realm_name);
-       int ret = realm.init(g_ceph_context, store->svc()->sysobj);
+       int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "failed to init realm: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4456,14 +4460,14 @@ int main(int argc, const char **argv)
 
        RGWZoneGroup zonegroup(zonegroup_name, is_master, g_ceph_context, store->svc()->sysobj, realm.get_id(), endpoints);
         zonegroup.api_name = (api_name.empty() ? zonegroup_name : api_name);
-       ret = zonegroup.create();
+       ret = zonegroup.create(null_yield);
        if (ret < 0) {
          cerr << "failed to create zonegroup " << zonegroup_name << ": " << cpp_strerror(-ret) << std::endl;
          return -ret;
        }
 
         if (set_default) {
-          ret = zonegroup.set_as_default();
+          ret = zonegroup.set_as_default(null_yield);
           if (ret < 0) {
             cerr << "failed to set zonegroup " << zonegroup_name << " as default: " << cpp_strerror(-ret) << std::endl;
           }
@@ -4481,13 +4485,13 @@ int main(int argc, const char **argv)
        }
 
        RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
-       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
          return -ret;
        }
 
-       ret = zonegroup.set_as_default();
+       ret = zonegroup.set_as_default(null_yield);
        if (ret < 0) {
          cerr << "failed to set zonegroup as default: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4501,12 +4505,13 @@ int main(int argc, const char **argv)
          return EINVAL;
        }
        RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
-       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj,
+                                null_yield);
        if (ret < 0) {
          cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
          return -ret;
        }
-       ret = zonegroup.delete_obj();
+       ret = zonegroup.delete_obj(null_yield);
        if (ret < 0) {
          cerr << "ERROR: couldn't delete zonegroup: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4516,7 +4521,7 @@ int main(int argc, const char **argv)
     case OPT::ZONEGROUP_GET:
       {
        RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
-       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4529,7 +4534,8 @@ int main(int argc, const char **argv)
     case OPT::ZONEGROUP_LIST:
       {
        RGWZoneGroup zonegroup;
-       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, false);
+       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj,
+                                null_yield, false);
        if (ret < 0) {
          cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4542,7 +4548,7 @@ int main(int argc, const char **argv)
          return -ret;
        }
        string default_zonegroup;
-       ret = zonegroup.read_default_id(default_zonegroup);
+       ret = zonegroup.read_default_id(default_zonegroup, null_yield);
        if (ret < 0 && ret != -ENOENT) {
          cerr << "could not determine default zonegroup: " << cpp_strerror(-ret) << std::endl;
        }
@@ -4556,7 +4562,7 @@ int main(int argc, const char **argv)
     case OPT::ZONEGROUP_MODIFY:
       {
        RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
-       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4570,7 +4576,7 @@ int main(int argc, const char **argv)
         }
 
        if (is_master_set) {
-         zonegroup.update_master(is_master);
+         zonegroup.update_master(is_master, null_yield);
           need_update = true;
         }
 
@@ -4590,7 +4596,7 @@ int main(int argc, const char **argv)
         } else if (!realm_name.empty()) {
           // get realm id from name
           RGWRealm realm{g_ceph_context, store->svc()->sysobj};
-          ret = realm.read_id(realm_name, zonegroup.realm_id);
+          ret = realm.read_id(realm_name, zonegroup.realm_id, null_yield);
           if (ret < 0) {
             cerr << "failed to find realm by name " << realm_name << std::endl;
             return -ret;
@@ -4606,7 +4612,7 @@ int main(int argc, const char **argv)
         }
 
         if (need_update) {
-         ret = zonegroup.update();
+         ret = zonegroup.update(null_yield);
          if (ret < 0) {
            cerr << "failed to update zonegroup: " << cpp_strerror(-ret) << std::endl;
            return -ret;
@@ -4614,7 +4620,7 @@ int main(int argc, const char **argv)
        }
 
         if (set_default) {
-          ret = zonegroup.set_as_default();
+          ret = zonegroup.set_as_default(null_yield);
           if (ret < 0) {
             cerr << "failed to set zonegroup " << zonegroup_name << " as default: " << cpp_strerror(-ret) << std::endl;
           }
@@ -4627,8 +4633,8 @@ int main(int argc, const char **argv)
     case OPT::ZONEGROUP_SET:
       {
        RGWRealm realm(realm_id, realm_name);
-       int ret = realm.init(g_ceph_context, store->svc()->sysobj);
-       bool default_realm_not_exist = (ret == -ENOENT && realm_id.empty() && realm_name.empty());
+       int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
+       bool default_realm_not_exist = (ret == -ENOENT && realm_id.empty() && realm_name.empty());
 
        if (ret < 0 && !default_realm_not_exist ) {
          cerr << "failed to init realm: " << cpp_strerror(-ret) << std::endl;
@@ -4636,7 +4642,8 @@ int main(int argc, const char **argv)
        }
 
        RGWZoneGroup zonegroup;
-       ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, false);
+       ret = zonegroup.init(g_ceph_context, store->svc()->sysobj,
+                            null_yield, false);
        if (ret < 0) {
          cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4648,12 +4655,12 @@ int main(int argc, const char **argv)
        if (zonegroup.realm_id.empty() && !default_realm_not_exist) {
          zonegroup.realm_id = realm.get_id();
        }
-       ret = zonegroup.create();
+       ret = zonegroup.create(null_yield);
        if (ret < 0 && ret != -EEXIST) {
          cerr << "ERROR: couldn't create zonegroup info: " << cpp_strerror(-ret) << std::endl;
          return 1;
        } else if (ret == -EEXIST) {
-         ret = zonegroup.update();
+         ret = zonegroup.update(null_yield);
          if (ret < 0) {
            cerr << "ERROR: couldn't store zonegroup info: " << cpp_strerror(-ret) << std::endl;
            return 1;
@@ -4661,7 +4668,7 @@ int main(int argc, const char **argv)
        }
 
         if (set_default) {
-          ret = zonegroup.set_as_default();
+          ret = zonegroup.set_as_default(null_yield);
           if (ret < 0) {
             cerr << "failed to set zonegroup " << zonegroup_name << " as default: " << cpp_strerror(-ret) << std::endl;
           }
@@ -4674,7 +4681,7 @@ int main(int argc, const char **argv)
     case OPT::ZONEGROUP_REMOVE:
       {
         RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
-        int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+        int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
         if (ret < 0) {
           cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
           return -ret;
@@ -4699,7 +4706,7 @@ int main(int argc, const char **argv)
           }
         }
 
-        ret = zonegroup.remove_zone(zone_id);
+        ret = zonegroup.remove_zone(zone_id, null_yield);
         if (ret < 0) {
           cerr << "failed to remove zone: " << cpp_strerror(-ret) << std::endl;
           return -ret;
@@ -4720,12 +4727,12 @@ int main(int argc, const char **argv)
          return EINVAL;
        }
        RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
-       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
          return -ret;
        }
-       ret = zonegroup.rename(zonegroup_new_name);
+       ret = zonegroup.rename(zonegroup_new_name, null_yield);
        if (ret < 0) {
          cerr << "failed to rename zonegroup: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4735,7 +4742,8 @@ int main(int argc, const char **argv)
     case OPT::ZONEGROUP_PLACEMENT_LIST:
       {
        RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
-       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj,
+                                null_yield);
        if (ret < 0) {
          cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4753,7 +4761,7 @@ int main(int argc, const char **argv)
        }
 
        RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
-       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4790,7 +4798,7 @@ int main(int argc, const char **argv)
         }
 
        RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
-       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4833,8 +4841,8 @@ int main(int argc, const char **argv)
           zonegroup.default_placement = rule;
         }
 
-        zonegroup.post_process_params();
-        ret = zonegroup.update();
+        zonegroup.post_process_params(null_yield);
+        ret = zonegroup.update(null_yield);
         if (ret < 0) {
           cerr << "failed to update zonegroup: " << cpp_strerror(-ret) << std::endl;
           return -ret;
@@ -4854,7 +4862,7 @@ int main(int argc, const char **argv)
        RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
        /* if the user didn't provide zonegroup info , create stand alone zone */
        if (!zonegroup_id.empty() || !zonegroup_name.empty()) {
-         ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+         ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
          if (ret < 0) {
            cerr << "unable to initialize zonegroup " << zonegroup_name << ": " << cpp_strerror(-ret) << std::endl;
            return -ret;
@@ -4865,7 +4873,7 @@ int main(int argc, const char **argv)
        }
 
        RGWZoneParams zone(zone_id, zone_name);
-       ret = zone.init(g_ceph_context, store->svc()->sysobj, false);
+       ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield, false);
        if (ret < 0) {
          cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4882,7 +4890,7 @@ int main(int argc, const char **argv)
           }
         }
 
-       ret = zone.create();
+       ret = zone.create(null_yield);
        if (ret < 0) {
          cerr << "failed to create zone " << zone_name << ": " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4900,7 +4908,8 @@ int main(int argc, const char **argv)
                                    psync_from_all,
                                    sync_from, sync_from_rm,
                                    predirect_zone, bucket_index_max_shards,
-                                  store->svc()->sync_modules->get_manager());
+                                  store->svc()->sync_modules->get_manager(),
+                                  null_yield);
          if (ret < 0) {
            cerr << "failed to add zone " << zone_name << " to zonegroup " << zonegroup.get_name()
                 << ": " << cpp_strerror(-ret) << std::endl;
@@ -4909,7 +4918,7 @@ int main(int argc, const char **argv)
        }
 
         if (set_default) {
-          ret = zone.set_as_default();
+          ret = zone.set_as_default(null_yield);
           if (ret < 0) {
             cerr << "failed to set zone " << zone_name << " as default: " << cpp_strerror(-ret) << std::endl;
           }
@@ -4922,7 +4931,7 @@ int main(int argc, const char **argv)
     case OPT::ZONE_DEFAULT:
       {
        RGWZoneGroup zonegroup(zonegroup_id,zonegroup_name);
-       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+       int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "WARNING: failed to initialize zonegroup " << zonegroup_name << std::endl;
        }
@@ -4931,12 +4940,12 @@ int main(int argc, const char **argv)
          return EINVAL;
        }
        RGWZoneParams zone(zone_id, zone_name);
-       ret = zone.init(g_ceph_context, store->svc()->sysobj);
+       ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
          return -ret;
        }
-       ret = zone.set_as_default();
+       ret = zone.set_as_default(null_yield);
        if (ret < 0) {
          cerr << "failed to set zone as default: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4950,7 +4959,7 @@ int main(int argc, const char **argv)
          return EINVAL;
        }
        RGWZoneParams zone(zone_id, zone_name);
-       int ret = zone.init(g_ceph_context, store->svc()->sysobj);
+       int ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4965,19 +4974,19 @@ int main(int argc, const char **argv)
 
         for (list<string>::iterator iter = zonegroups.begin(); iter != zonegroups.end(); ++iter) {
           RGWZoneGroup zonegroup(string(), *iter);
-          int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+          int ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
           if (ret < 0) {
             cerr << "WARNING: failed to initialize zonegroup " << zonegroup_name << std::endl;
             continue;
           }
-          ret = zonegroup.remove_zone(zone.get_id());
+          ret = zonegroup.remove_zone(zone.get_id(), null_yield);
           if (ret < 0 && ret != -ENOENT) {
             cerr << "failed to remove zone " << zone_name << " from zonegroup " << zonegroup.get_name() << ": "
               << cpp_strerror(-ret) << std::endl;
           }
         }
 
-       ret = zone.delete_obj();
+       ret = zone.delete_obj(null_yield);
        if (ret < 0) {
          cerr << "failed to delete zone " << zone_name << ": " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4987,7 +4996,7 @@ int main(int argc, const char **argv)
     case OPT::ZONE_GET:
       {
        RGWZoneParams zone(zone_id, zone_name);
-       int ret = zone.init(g_ceph_context, store->svc()->sysobj);
+       int ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -4999,12 +5008,13 @@ int main(int argc, const char **argv)
     case OPT::ZONE_SET:
       {
        RGWZoneParams zone(zone_name);
-       int ret = zone.init(g_ceph_context, store->svc()->sysobj, false);
+       int ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield,
+                           false);
        if (ret < 0) {
          return -ret;
        }
 
-        ret = zone.read();
+        ret = zone.read(null_yield);
         if (ret < 0 && ret != -ENOENT) {
          cerr << "zone.read() returned ret=" << ret << std::endl;
           return -ret;
@@ -5019,7 +5029,7 @@ int main(int argc, const char **argv)
 
        if(zone.realm_id.empty()) {
          RGWRealm realm(realm_id, realm_name);
-         int ret = realm.init(g_ceph_context, store->svc()->sysobj);
+         int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
          if (ret < 0 && ret != -ENOENT) {
            cerr << "failed to init realm: " << cpp_strerror(-ret) << std::endl;
            return -ret;
@@ -5057,19 +5067,19 @@ int main(int argc, const char **argv)
        }
 
        cerr << "zone id " << zone.get_id();
-       ret = zone.fix_pool_names();
+       ret = zone.fix_pool_names(null_yield);
        if (ret < 0) {
          cerr << "ERROR: couldn't fix zone: " << cpp_strerror(-ret) << std::endl;
          return -ret;
        }
-       ret = zone.write(false);
+       ret = zone.write(false, null_yield);
        if (ret < 0) {
          cerr << "ERROR: couldn't create zone: " << cpp_strerror(-ret) << std::endl;
          return 1;
        }
 
         if (set_default) {
-          ret = zone.set_as_default();
+          ret = zone.set_as_default(null_yield);
           if (ret < 0) {
             cerr << "failed to set zone " << zone_name << " as default: " << cpp_strerror(-ret) << std::endl;
           }
@@ -5089,13 +5099,13 @@ int main(int argc, const char **argv)
        }
 
        RGWZoneParams zone;
-       ret = zone.init(g_ceph_context, store->svc()->sysobj, false);
+       ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield, false);
        if (ret < 0) {
          cerr << "failed to init zone: " << cpp_strerror(-ret) << std::endl;
          return -ret;
        }
        string default_zone;
-       ret = zone.read_default_id(default_zone);
+       ret = zone.read_default_id(default_zone, null_yield);
        if (ret < 0 && ret != -ENOENT) {
          cerr << "could not determine default zone: " << cpp_strerror(-ret) << std::endl;
        }
@@ -5109,7 +5119,7 @@ int main(int argc, const char **argv)
     case OPT::ZONE_MODIFY:
       {
        RGWZoneParams zone(zone_id, zone_name);
-       int ret = zone.init(g_ceph_context, store->svc()->sysobj);
+       int ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
         if (ret < 0) {
          cerr << "failed to init zone: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -5132,7 +5142,7 @@ int main(int argc, const char **argv)
         } else if (!realm_name.empty()) {
           // get realm id from name
           RGWRealm realm{g_ceph_context, store->svc()->sysobj};
-          ret = realm.read_id(realm_name, zone.realm_id);
+          ret = realm.read_id(realm_name, zone.realm_id, null_yield);
           if (ret < 0) {
             cerr << "failed to find realm by name " << realm_name << std::endl;
             return -ret;
@@ -5159,7 +5169,7 @@ int main(int argc, const char **argv)
         }
 
         if (need_zone_update) {
-          ret = zone.update();
+          ret = zone.update(null_yield);
           if (ret < 0) {
             cerr << "failed to save zone info: " << cpp_strerror(-ret) << std::endl;
             return -ret;
@@ -5167,7 +5177,7 @@ int main(int argc, const char **argv)
         }
 
        RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
-       ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+       ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -5183,20 +5193,21 @@ int main(int argc, const char **argv)
                                  endpoints, ptier_type,
                                  psync_from_all, sync_from, sync_from_rm,
                                  predirect_zone, bucket_index_max_shards,
-                                store->svc()->sync_modules->get_manager());
+                                store->svc()->sync_modules->get_manager(),
+                                null_yield);
        if (ret < 0) {
          cerr << "failed to update zonegroup: " << cpp_strerror(-ret) << std::endl;
          return -ret;
        }
 
-       ret = zonegroup.update();
+       ret = zonegroup.update(null_yield);
        if (ret < 0) {
          cerr << "failed to update zonegroup: " << cpp_strerror(-ret) << std::endl;
          return -ret;
        }
 
         if (set_default) {
-          ret = zone.set_as_default();
+          ret = zone.set_as_default(null_yield);
           if (ret < 0) {
             cerr << "failed to set zone " << zone_name << " as default: " << cpp_strerror(-ret) << std::endl;
           }
@@ -5217,23 +5228,23 @@ int main(int argc, const char **argv)
          return EINVAL;
        }
        RGWZoneParams zone(zone_id,zone_name);
-       int ret = zone.init(g_ceph_context, store->svc()->sysobj);
+       int ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
          return -ret;
        }
-       ret = zone.rename(zone_new_name);
+       ret = zone.rename(zone_new_name, null_yield);
        if (ret < 0) {
          cerr << "failed to rename zone " << zone_name << " to " << zone_new_name << ": " << cpp_strerror(-ret)
               << std::endl;
          return -ret;
        }
        RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
-       ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+       ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "WARNING: failed to initialize zonegroup " << zonegroup_name << std::endl;
        } else {
-         ret = zonegroup.rename_zone(zone);
+         ret = zonegroup.rename_zone(zone, null_yield);
          if (ret < 0) {
            cerr << "Error in zonegroup rename for " << zone_name << ": " << cpp_strerror(-ret) << std::endl;
            return -ret;
@@ -5257,7 +5268,7 @@ int main(int argc, const char **argv)
         }
 
        RGWZoneParams zone(zone_id, zone_name);
-       int ret = zone.init(g_ceph_context, store->svc()->sysobj);
+       int ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
         if (ret < 0) {
          cerr << "failed to init zone: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -5266,7 +5277,7 @@ int main(int argc, const char **argv)
         if (opt_cmd == OPT::ZONE_PLACEMENT_ADD ||
            opt_cmd == OPT::ZONE_PLACEMENT_MODIFY) {
          RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name);
-         ret = zonegroup.init(g_ceph_context, store->svc()->sysobj);
+         ret = zonegroup.init(g_ceph_context, store->svc()->sysobj, null_yield);
          if (ret < 0) {
            cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl;
            return -ret;
@@ -5340,7 +5351,7 @@ int main(int argc, const char **argv)
           }
         }
 
-        ret = zone.update();
+        ret = zone.update(null_yield);
         if (ret < 0) {
           cerr << "failed to save zone info: " << cpp_strerror(-ret) << std::endl;
           return -ret;
@@ -5353,7 +5364,7 @@ int main(int argc, const char **argv)
     case OPT::ZONE_PLACEMENT_LIST:
       {
        RGWZoneParams zone(zone_id, zone_name);
-       int ret = zone.init(g_ceph_context, store->svc()->sysobj);
+       int ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -5370,7 +5381,7 @@ int main(int argc, const char **argv)
        }
 
        RGWZoneParams zone(zone_id, zone_name);
-       int ret = zone.init(g_ceph_context, store->svc()->sysobj);
+       int ret = zone.init(g_ceph_context, store->svc()->sysobj, null_yield);
        if (ret < 0) {
          cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
          return -ret;
@@ -5669,7 +5680,7 @@ int main(int argc, const char **argv)
 
       // load the period
       RGWPeriod period(period_id);
-      int ret = period.init(g_ceph_context, store->svc()->sysobj);
+      int ret = period.init(g_ceph_context, store->svc()->sysobj, null_yield);
       if (ret < 0) {
         cerr << "period init failed: " << cpp_strerror(-ret) << std::endl;
         return -ret;
@@ -5703,13 +5714,13 @@ int main(int argc, const char **argv)
     {
       // read realm and staging period
       RGWRealm realm(realm_id, realm_name);
-      int ret = realm.init(g_ceph_context, store->svc()->sysobj);
+      int ret = realm.init(g_ceph_context, store->svc()->sysobj, null_yield);
       if (ret < 0) {
         cerr << "Error initializing realm: " << cpp_strerror(-ret) << std::endl;
         return -ret;
       }
       RGWPeriod period(RGWPeriod::get_staging_id(realm.get_id()), 1);
-      ret = period.init(g_ceph_context, store->svc()->sysobj, realm.get_id());
+      ret = period.init(g_ceph_context, store->svc()->sysobj, realm.get_id(), null_yield);
       if (ret < 0) {
         cerr << "period init failed: " << cpp_strerror(-ret) << std::endl;
         return -ret;
@@ -7804,7 +7815,7 @@ next:
       return -ret;
     }
 
-    ret = sync.run();
+    ret = sync.run(null_yield);
     if (ret < 0) {
       cerr << "ERROR: sync.run() returned ret=" << ret << std::endl;
       return -ret;
index 8e10edd5b71e0f1e2d14d2663b0ef06d605020d7..d8803416eb68e9240d09e774d00b27c4632d23d3 100644 (file)
@@ -600,7 +600,7 @@ int radosgw_Main(int argc, const char **argv)
 
 
   // add a watcher to respond to realm configuration changes
-  RGWPeriodPusher pusher(store);
+  RGWPeriodPusher pusher(store, null_yield);
   RGWFrontendPauser pauser(fes, implicit_tenant_context, &pusher);
   auto reloader = std::make_unique<RGWRealmReloader>(store,
                                                     service_map_meta, &pauser);
index 497dd1d41431eec14f58629c9d95bf2ed823014c..67c63e7beaa41e60c3ee88972bfa67e36eb662ad 100644 (file)
@@ -85,7 +85,7 @@ class RGWPeriodHistory::Impl final {
   ~Impl();
 
   Cursor get_current() const { return current_cursor; }
-  Cursor attach(RGWPeriod&& period);
+  Cursor attach(RGWPeriod&& period, optional_yield y);
   Cursor insert(RGWPeriod&& period);
   Cursor lookup(epoch_t realm_epoch);
 
@@ -148,7 +148,7 @@ RGWPeriodHistory::Impl::~Impl()
   histories.clear_and_dispose(std::default_delete<History>{});
 }
 
-Cursor RGWPeriodHistory::Impl::attach(RGWPeriod&& period)
+Cursor RGWPeriodHistory::Impl::attach(RGWPeriod&& period, optional_yield y)
 {
   if (current_history == histories.end()) {
     return Cursor{-EINVAL};
@@ -184,7 +184,7 @@ Cursor RGWPeriodHistory::Impl::attach(RGWPeriod&& period)
     }
 
     // pull the period outside of the lock
-    int r = puller->pull(predecessor_id, period);
+    int r = puller->pull(predecessor_id, period, y);
     if (r < 0) {
       return Cursor{r};
     }
@@ -339,9 +339,9 @@ Cursor RGWPeriodHistory::get_current() const
 {
   return impl->get_current();
 }
-Cursor RGWPeriodHistory::attach(RGWPeriod&& period)
+Cursor RGWPeriodHistory::attach(RGWPeriod&& period, optional_yield y)
 {
-  return impl->attach(std::move(period));
+  return impl->attach(std::move(period), y);
 }
 Cursor RGWPeriodHistory::insert(RGWPeriod&& period)
 {
index f7eef51ef44bdeb94d34aaa8311ea8886b9db131..6004db2efef3adc86b4deea0ae2685107c8a2720 100644 (file)
@@ -10,6 +10,7 @@
 #include <boost/intrusive/avl_set.hpp>
 #include "include/ceph_assert.h"
 #include "include/types.h"
+#include "common/async/yield_context.h"
 
 namespace bi = boost::intrusive;
 
@@ -41,7 +42,8 @@ class RGWPeriodHistory final {
    public:
     virtual ~Puller() = default;
 
-    virtual int pull(const std::string& period_id, RGWPeriod& period) = 0;
+    virtual int pull(const std::string& period_id, RGWPeriod& period,
+                    optional_yield y) = 0;
   };
 
   RGWPeriodHistory(CephContext* cct, Puller* puller,
@@ -98,7 +100,7 @@ class RGWPeriodHistory final {
   /// current_period and the given period, reading predecessor periods or
   /// fetching them from the master as necessary. returns a cursor at the
   /// given period that can be used to traverse the current_history
-  Cursor attach(RGWPeriod&& period);
+  Cursor attach(RGWPeriod&& period, optional_yield y);
 
   /// insert the given period into an existing history, or create a new
   /// unconnected history. similar to attach(), but it doesn't try to fetch
index 65e1471e4934ca9b67e65f1fb199ea4300778c3d..ebc4a0dc09bfc4dfdd0507f697ba60abe9d1e97a 100644 (file)
@@ -63,12 +63,13 @@ int pull_period(RGWRESTConn* conn, const std::string& period_id,
 
 } // anonymous namespace
 
-int RGWPeriodPuller::pull(const std::string& period_id, RGWPeriod& period)
+int RGWPeriodPuller::pull(const std::string& period_id, RGWPeriod& period,
+                         optional_yield y)
 {
   // try to read the period from rados
   period.set_id(period_id);
   period.set_epoch(0);
-  int r = period.init(cct, svc.sysobj);
+  int r = period.init(cct, svc.sysobj, y);
   if (r < 0) {
     if (svc.zone->is_meta_master()) {
       // can't pull if we're the master
@@ -86,7 +87,7 @@ int RGWPeriodPuller::pull(const std::string& period_id, RGWPeriod& period)
       return r;
     }
     // write the period to rados
-    r = period.store_info(true);
+    r = period.store_info(true, y);
     if (r == -EEXIST) {
       r = 0;
     } else if (r < 0) {
@@ -94,7 +95,7 @@ int RGWPeriodPuller::pull(const std::string& period_id, RGWPeriod& period)
       return r;
     }
     // update latest epoch
-    r = period.update_latest_epoch(period.get_epoch());
+    r = period.update_latest_epoch(period.get_epoch(), y);
     if (r == -EEXIST) {
       // already have this epoch (or a more recent one)
       return 0;
@@ -106,7 +107,7 @@ int RGWPeriodPuller::pull(const std::string& period_id, RGWPeriod& period)
     }
     // reflect period objects if this is the latest version
     if (svc.zone->get_realm().get_current_period() == period_id) {
-      r = period.reflect();
+      r = period.reflect(y);
       if (r < 0) {
         return r;
       }
index d1a852cb9ef85760e085e77b06e5b49f7f467b1d..7ac5cc8dce5a127d0f1530fd3c0dc27ab718efe7 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "rgw_period_history.h"
 #include "include/common_fwd.h"
+#include "rgw/services/svc_sys_obj.h"
 
 class RGWPeriod;
 
@@ -20,7 +21,7 @@ class RGWPeriodPuller : public RGWPeriodHistory::Puller {
  public:
   explicit RGWPeriodPuller(RGWSI_Zone *zone_svc, RGWSI_SysObj *sysobj_svc);
 
-  int pull(const std::string& period_id, RGWPeriod& period) override;
+  int pull(const std::string& period_id, RGWPeriod& period, optional_yield y) override;
 };
 
 #endif // CEPH_RGW_PERIOD_PULLER_H
index d8742c32e21ebdfb7f987786ba02a3b32f71bb7d..0eb394ed9c7ad37ed56845202ae1117528b15b18 100644 (file)
@@ -158,7 +158,8 @@ class RGWPeriodPusher::CRThread {
 };
 
 
-RGWPeriodPusher::RGWPeriodPusher(rgw::sal::RGWRadosStore* store)
+RGWPeriodPusher::RGWPeriodPusher(rgw::sal::RGWRadosStore* store,
+                                optional_yield y)
   : cct(store->ctx()), store(store)
 {
   const auto& realm = store->svc()->zone->get_realm();
@@ -168,7 +169,7 @@ RGWPeriodPusher::RGWPeriodPusher(rgw::sal::RGWRadosStore* store)
 
   // always send out the current period on startup
   RGWPeriod period;
-  int r = period.init(cct, store->svc()->sysobj, realm_id, realm.get_name());
+  int r = period.init(cct, store->svc()->sysobj, realm_id, y, realm.get_name());
   if (r < 0) {
     lderr(cct) << "failed to load period for realm " << realm_id << dendl;
     return;
index 22ed6380a2aeb1c628a56fb66d36af2c90df48cc..fded5095c1b22193d7810ed8bd80a858667b7138 100644 (file)
@@ -8,6 +8,7 @@
 #include <mutex>
 #include <vector>
 
+#include "common/async/yield_context.h"
 #include "rgw_realm_reloader.h"
 
 namespace rgw {
@@ -28,7 +29,7 @@ using RGWZonesNeedPeriod = RGWPeriod;
 class RGWPeriodPusher final : public RGWRealmWatcher::Watcher,
                               public RGWRealmReloader::Pauser {
  public:
-  explicit RGWPeriodPusher(rgw::sal::RGWRadosStore* store);
+  explicit RGWPeriodPusher(rgw::sal::RGWRadosStore* store, optional_yield y);
   ~RGWPeriodPusher() override;
 
   /// respond to realm notifications by pushing new periods to other zones
index 44bfcea027ef9a04b3677486061244b2d2e73cd1..684a6c04f974d028aa156a22a2f7e155480a79bc 100644 (file)
@@ -517,7 +517,7 @@ public:
   }
 
   int process() override {
-    sync.run();
+    sync.run(null_yield);
     return 0;
   }
 };
index 60cf80f731f691094f287a355f2e141a7670666d..9d906ec4c7bbcf369a447ec792af9938287f0848 100644 (file)
@@ -31,7 +31,7 @@
 #define dout_subsys ceph_subsys_rgw
 
 void RGWOp_ZoneGroupMap_Get::execute(optional_yield y) {
-  op_ret = zonegroup_map.read(g_ceph_context, store->svc()->sysobj);
+  op_ret = zonegroup_map.read(g_ceph_context, store->svc()->sysobj, y);
   if (op_ret < 0) {
     dout(5) << "failed to read zone_group map" << dendl;
   }
index 17b0cd961211da19e01f75a92eb2fd755736ae4b..12aee6dcc7f828a30622f26a53c55d1e548fb1a1 100644 (file)
@@ -73,7 +73,7 @@ void RGWOp_Period_Get::execute(optional_yield y)
   period.set_id(period_id);
   period.set_epoch(epoch);
 
-  op_ret = period.init(store->ctx(), store->svc()->sysobj, realm_id, realm_name);
+  op_ret = period.init(store->ctx(), store->svc()->sysobj, realm_id, y, realm_name);
   if (op_ret < 0)
     ldout(store->ctx(), 5) << "failed to read period" << dendl;
 }
@@ -96,7 +96,7 @@ void RGWOp_Period_Post::execute(optional_yield y)
   auto cct = store->ctx();
 
   // initialize the period without reading from rados
-  period.init(cct, store->svc()->sysobj, false);
+  period.init(cct, store->svc()->sysobj, y, false);
 
   // decode the period from input
   const auto max_size = cct->_conf->rgw_max_put_param_size;
@@ -119,7 +119,7 @@ void RGWOp_Period_Post::execute(optional_yield y)
   // period that we haven't restarted with yet. we also don't want to modify
   // the objects in use by RGWRados
   RGWRealm realm(period.get_realm());
-  op_ret = realm.init(cct, store->svc()->sysobj);
+  op_ret = realm.init(cct, store->svc()->sysobj, y);
   if (op_ret < 0) {
     lderr(cct) << "failed to read current realm: "
         << cpp_strerror(-op_ret) << dendl;
@@ -127,7 +127,7 @@ void RGWOp_Period_Post::execute(optional_yield y)
   }
 
   RGWPeriod current_period;
-  op_ret = current_period.init(cct, store->svc()->sysobj, realm.get_id());
+  op_ret = current_period.init(cct, store->svc()->sysobj, realm.get_id(), y);
   if (op_ret < 0) {
     lderr(cct) << "failed to read current period: "
         << cpp_strerror(-op_ret) << dendl;
@@ -136,7 +136,7 @@ void RGWOp_Period_Post::execute(optional_yield y)
 
   // if period id is empty, handle as 'period commit'
   if (period.get_id().empty()) {
-    op_ret = period.commit(store, realm, current_period, error_stream);
+    op_ret = period.commit(store, realm, current_period, error_stream, y);
     if (op_ret < 0) {
       lderr(cct) << "master zone failed to commit period" << dendl;
     }
@@ -152,13 +152,13 @@ void RGWOp_Period_Post::execute(optional_yield y)
   }
 
   // write the period to rados
-  op_ret = period.store_info(false);
+  op_ret = period.store_info(false, y);
   if (op_ret < 0) {
     lderr(cct) << "failed to store period " << period.get_id() << dendl;
     return;
   }
   // set as latest epoch
-  op_ret = period.update_latest_epoch(period.get_epoch());
+  op_ret = period.update_latest_epoch(period.get_epoch(), y);
   if (op_ret == -EEXIST) {
     // already have this epoch (or a more recent one)
     ldout(cct, 4) << "already have epoch >= " << period.get_epoch()
@@ -193,7 +193,7 @@ void RGWOp_Period_Post::execute(optional_yield y)
       return;
     }
     // attach a copy of the period into the period history
-    auto cursor = period_history->attach(RGWPeriod{period});
+    auto cursor = period_history->attach(RGWPeriod{period}, y);
     if (!cursor) {
       // we're missing some history between the new period and current_period
       op_ret = cursor.get_error();
@@ -211,7 +211,7 @@ void RGWOp_Period_Post::execute(optional_yield y)
       return;
     }
     // set as current period
-    op_ret = realm.set_current_period(period);
+    op_ret = realm.set_current_period(period, y);
     if (op_ret < 0) {
       lderr(cct) << "failed to update realm's current period" << dendl;
       return;
@@ -219,11 +219,11 @@ void RGWOp_Period_Post::execute(optional_yield y)
     ldout(cct, 4) << "period " << period.get_id()
         << " is newer than current period " << current_period.get_id()
         << ", updating realm's current period and notifying zone" << dendl;
-    realm.notify_new_period(period);
+    realm.notify_new_period(period, y);
     return;
   }
   // reflect the period into our local objects
-  op_ret = period.reflect();
+  op_ret = period.reflect(y);
   if (op_ret < 0) {
     lderr(cct) << "failed to update local objects: "
         << cpp_strerror(-op_ret) << dendl;
@@ -232,7 +232,7 @@ void RGWOp_Period_Post::execute(optional_yield y)
   ldout(cct, 4) << "period epoch " << period.get_epoch()
       << " is newer than current epoch " << current_period.get_epoch()
       << ", updating period's latest epoch and notifying zone" << dendl;
-  realm.notify_new_period(period);
+  realm.notify_new_period(period, y);
   // update the period history
   period_history->insert(RGWPeriod{period});
 }
@@ -280,7 +280,7 @@ void RGWOp_Realm_Get::execute(optional_yield y)
 
   // read realm
   realm.reset(new RGWRealm(id, name));
-  op_ret = realm->init(g_ceph_context, store->svc()->sysobj);
+  op_ret = realm->init(g_ceph_context, store->svc()->sysobj, y);
   if (op_ret < 0)
     lderr(store->ctx()) << "failed to read realm id=" << id
         << " name=" << name << dendl;
@@ -322,7 +322,7 @@ void RGWOp_Realm_List::execute(optional_yield y)
   {
     // read default realm
     RGWRealm realm(store->ctx(), store->svc()->sysobj);
-    [[maybe_unused]] int ret = realm.read_default_id(default_id);
+    [[maybe_unused]] int ret = realm.read_default_id(default_id, y);
   }
   op_ret = store->svc()->zone->list_realms(realms);
   if (op_ret < 0)
index 66bec533ce6430ed6cb5e32b5980d0bbbf4cf8cc..a934a2e28a50d52a0dac8a5688ba3171749677ed 100644 (file)
@@ -2088,7 +2088,8 @@ int RGWRemoteMetaLog::store_sync_info(const rgw_meta_sync_info& sync_info)
 
 // return a cursor to the period at our sync position
 static RGWPeriodHistory::Cursor get_period_at(rgw::sal::RGWRadosStore* store,
-                                              const rgw_meta_sync_info& info)
+                                              const rgw_meta_sync_info& info,
+                                             optional_yield y)
 {
   if (info.period.empty()) {
     // return an empty cursor with error=0
@@ -2111,14 +2112,14 @@ static RGWPeriodHistory::Cursor get_period_at(rgw::sal::RGWRadosStore* store,
 
   // read the period from rados or pull it from the master
   RGWPeriod period;
-  int r = store->svc()->mdlog->pull_period(info.period, period);
+  int r = store->svc()->mdlog->pull_period(info.period, period, y);
   if (r < 0) {
     lderr(store->ctx()) << "ERROR: failed to read period id "
         << info.period << ": " << cpp_strerror(r) << dendl;
     return RGWPeriodHistory::Cursor{r};
   }
   // attach the period to our history
-  cursor = store->svc()->mdlog->get_period_history()->attach(std::move(period));
+  cursor = store->svc()->mdlog->get_period_history()->attach(std::move(period), y);
   if (!cursor) {
     r = cursor.get_error();
     lderr(store->ctx()) << "ERROR: failed to read period history back to "
@@ -2127,7 +2128,7 @@ static RGWPeriodHistory::Cursor get_period_at(rgw::sal::RGWRadosStore* store,
   return cursor;
 }
 
-int RGWRemoteMetaLog::run_sync()
+int RGWRemoteMetaLog::run_sync(optional_yield y)
 {
   if (store->svc()->zone->is_meta_master()) {
     return 0;
@@ -2249,7 +2250,7 @@ int RGWRemoteMetaLog::run_sync()
       case rgw_meta_sync_info::StateSync:
         tn->log(20, "sync");
         // find our position in the period history (if any)
-        cursor = get_period_at(store, sync_status.sync_info);
+        cursor = get_period_at(store, sync_status.sync_info, y);
         r = cursor.get_error();
         if (r < 0) {
           return r;
index e7e4f5b4e78f85c7e44417829d99837e130ac38c..4d0d72c9839f9ec150d585c342e10e065016aca9 100644 (file)
@@ -236,7 +236,7 @@ public:
   int read_master_log_shards_next(const string& period, map<int, string> shard_markers, map<int, rgw_mdlog_shard_data> *result);
   int read_sync_status(rgw_meta_sync_status *sync_status);
   int init_sync_status();
-  int run_sync();
+  int run_sync(optional_yield y);
 
   void wakeup(int shard_id);
 
@@ -291,7 +291,7 @@ public:
     return master_log.read_master_log_shards_next(period, shard_markers, result);
   }
 
-  int run() { return master_log.run_sync(); }
+  int run(optional_yield y) { return master_log.run_sync(y); }
 
 
   // implements DoutPrefixProvider
index 6a8f2ee712c740dcf4012026d70eaf74aad1e4b3..51e2fd3e0e0b89e38874940dca180cddcc405d3d 100644 (file)
@@ -67,7 +67,7 @@ rgw_pool RGWZoneGroup::get_pool(CephContext *cct_) const
   return rgw_pool(cct_->_conf->rgw_zonegroup_root_pool);
 }
 
-int RGWZoneGroup::create_default(bool old_format)
+int RGWZoneGroup::create_default(optional_yield y, bool old_format)
 {
   name = default_zonegroup_name;
   api_name = default_zonegroup_name;
@@ -80,20 +80,20 @@ int RGWZoneGroup::create_default(bool old_format)
 
   RGWZoneParams zone_params(default_zone_name);
 
-  int r = zone_params.init(cct, sysobj_svc, false);
+  int r = zone_params.init(cct, sysobj_svc, y, false);
   if (r < 0) {
     ldout(cct, 0) << "create_default: error initializing zone params: " << cpp_strerror(-r) << dendl;
     return r;
   }
 
-  r = zone_params.create_default();
+  r = zone_params.create_default(y);
   if (r < 0 && r != -EEXIST) {
     ldout(cct, 0) << "create_default: error in create_default  zone params: " << cpp_strerror(-r) << dendl;
     return r;
   } else if (r == -EEXIST) {
     ldout(cct, 10) << "zone_params::create_default() returned -EEXIST, we raced with another default zone_params creation" << dendl;
     zone_params.clear_id();
-    r = zone_params.init(cct, sysobj_svc);
+    r = zone_params.init(cct, sysobj_svc, y);
     if (r < 0) {
       ldout(cct, 0) << "create_default: error in init existing zone params: " << cpp_strerror(-r) << dendl;
       return r;
@@ -107,7 +107,7 @@ int RGWZoneGroup::create_default(bool old_format)
   default_zone.id = zone_params.get_id();
   master_zone = default_zone.id;
   
-  r = create();
+  r = create(y);
   if (r < 0 && r != -EEXIST) {
     ldout(cct, 0) << "error storing zone group info: " << cpp_strerror(-r) << dendl;
     return r;
@@ -116,7 +116,7 @@ int RGWZoneGroup::create_default(bool old_format)
   if (r == -EEXIST) {
     ldout(cct, 10) << "create_default() returned -EEXIST, we raced with another zonegroup creation" << dendl;
     id.clear();
-    r = init(cct, sysobj_svc);
+    r = init(cct, sysobj_svc, y);
     if (r < 0) {
       return r;
     }
@@ -126,7 +126,7 @@ int RGWZoneGroup::create_default(bool old_format)
     name = id;
   }
 
-  post_process_params();
+  post_process_params(y);
 
   return 0;
 }
@@ -180,7 +180,8 @@ int RGWZoneGroup::add_zone(const RGWZoneParams& zone_params, bool *is_master, bo
                            const list<string>& endpoints, const string *ptier_type,
                            bool *psync_from_all, list<string>& sync_from, list<string>& sync_from_rm,
                            string *predirect_zone, std::optional<int> bucket_index_max_shards,
-                           RGWSyncModulesManager *sync_mgr)
+                           RGWSyncModulesManager *sync_mgr,
+                          optional_yield y)
 {
   auto& zone_id = zone_params.get_id();
   auto& zone_name = zone_params.get_name();
@@ -247,21 +248,22 @@ int RGWZoneGroup::add_zone(const RGWZoneParams& zone_params, bool *is_master, bo
     zone.sync_from.erase(rm);
   }
 
-  post_process_params();
+  post_process_params(y);
 
-  return update();
+  return update(y);
 }
 
 
-int RGWZoneGroup::rename_zone(const RGWZoneParams& zone_params)
-{ 
+int RGWZoneGroup::rename_zone(const RGWZoneParams& zone_params,
+                             optional_yield y)
+{
   RGWZone& zone = zones[zone_params.get_id()];
   zone.name = zone_params.get_name();
-  
-  return update();
+
+  return update(y);
 }
 
-void RGWZoneGroup::post_process_params()
+void RGWZoneGroup::post_process_params(optional_yield y)
 {
   bool log_data = zones.size() > 1;
 
@@ -277,7 +279,7 @@ void RGWZoneGroup::post_process_params()
     zone.log_data = log_data;
 
     RGWZoneParams zone_params(zone.id, zone.name);
-    int ret = zone_params.init(cct, sysobj_svc);
+    int ret = zone_params.init(cct, sysobj_svc, y);
     if (ret < 0) {
       ldout(cct, 0) << "WARNING: could not read zone params for zone id=" << zone.id << " name=" << zone.name << dendl;
       continue;
@@ -298,7 +300,7 @@ void RGWZoneGroup::post_process_params()
   }
 }
 
-int RGWZoneGroup::remove_zone(const std::string& zone_id)
+int RGWZoneGroup::remove_zone(const std::string& zone_id, optional_yield y)
 {
   auto iter = zones.find(zone_id);
   if (iter == zones.end()) {
@@ -309,33 +311,34 @@ int RGWZoneGroup::remove_zone(const std::string& zone_id)
 
   zones.erase(iter);
 
-  post_process_params();
+  post_process_params(y);
 
-  return update();
+  return update(y);
 }
 
-int RGWZoneGroup::read_default_id(string& default_id, bool old_format)
+int RGWZoneGroup::read_default_id(string& default_id, optional_yield y,
+                                 bool old_format)
 {
   if (realm_id.empty()) {
     /* try using default realm */
     RGWRealm realm;
-    int ret = realm.init(cct, sysobj_svc);
+    int ret = realm.init(cct, sysobj_svc, y);
     // no default realm exist
     if (ret < 0) {
-      return read_id(default_zonegroup_name, default_id);
+      return read_id(default_zonegroup_name, default_id, y);
     }
     realm_id = realm.get_id();
   }
 
-  return RGWSystemMetaObj::read_default_id(default_id, old_format);
+  return RGWSystemMetaObj::read_default_id(default_id, y, old_format);
 }
 
-int RGWZoneGroup::set_as_default(bool exclusive)
+int RGWZoneGroup::set_as_default(optional_yield y, bool exclusive)
 {
   if (realm_id.empty()) {
     /* try using default realm */
     RGWRealm realm;
-    int ret = realm.init(cct, sysobj_svc);
+    int ret = realm.init(cct, sysobj_svc, y);
     if (ret < 0) {
       ldout(cct, 10) << "could not read realm id: " << cpp_strerror(-ret) << dendl;
       return -EINVAL;
@@ -343,7 +346,7 @@ int RGWZoneGroup::set_as_default(bool exclusive)
     realm_id = realm.get_id();
   }
 
-  return RGWSystemMetaObj::set_as_default(exclusive);
+  return RGWSystemMetaObj::set_as_default(y, exclusive);
 }
 
 void RGWSystemMetaObj::reinit_instance(CephContext *_cct, RGWSI_SysObj *_sysobj_svc)
@@ -353,7 +356,9 @@ void RGWSystemMetaObj::reinit_instance(CephContext *_cct, RGWSI_SysObj *_sysobj_
   zone_svc = _sysobj_svc->get_zone_svc();
 }
 
-int RGWSystemMetaObj::init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, bool setup_obj, bool old_format)
+int RGWSystemMetaObj::init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc,
+                          optional_yield y,
+                          bool setup_obj, bool old_format)
 {
   reinit_instance(_cct, _sysobj_svc);
 
@@ -370,12 +375,12 @@ int RGWSystemMetaObj::init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, bool se
       name = get_predefined_name(cct);
     }
     if (name.empty()) {
-      r = use_default(old_format);
+      r = use_default(y, old_format);
       if (r < 0) {
        return r;
       }
     } else if (!old_format) {
-      r = read_id(name, id);
+      r = read_id(name, id, y);
       if (r < 0) {
         if (r != -ENOENT) {
           ldout(cct, 0) << "error in read_id for object name: " << name << " : " << cpp_strerror(-r) << dendl;
@@ -385,10 +390,11 @@ int RGWSystemMetaObj::init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, bool se
     }
   }
 
-  return read_info(id, old_format);
+  return read_info(id, y, old_format);
 }
 
-int RGWSystemMetaObj::read_default(RGWDefaultSystemMetaObjInfo& default_info, const string& oid)
+int RGWSystemMetaObj::read_default(RGWDefaultSystemMetaObjInfo& default_info,
+                                  const string& oid, optional_yield y)
 {
   using ceph::decode;
   auto pool = get_pool(cct);
@@ -396,7 +402,7 @@ int RGWSystemMetaObj::read_default(RGWDefaultSystemMetaObjInfo& default_info, co
 
   auto obj_ctx = sysobj_svc->init_obj_ctx();
   auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj(pool, oid));
-  int ret = sysobj.rop().read(&bl, null_yield);
+  int ret = sysobj.rop().read(&bl, y);
   if (ret < 0)
     return ret;
 
@@ -411,11 +417,12 @@ int RGWSystemMetaObj::read_default(RGWDefaultSystemMetaObjInfo& default_info, co
   return 0;
 }
 
-int RGWSystemMetaObj::read_default_id(string& default_id, bool old_format)
+int RGWSystemMetaObj::read_default_id(string& default_id, optional_yield y,
+                                     bool old_format)
 {
   RGWDefaultSystemMetaObjInfo default_info;
 
-  int ret = read_default(default_info, get_default_oid(old_format));
+  int ret = read_default(default_info, get_default_oid(old_format), y);
   if (ret < 0) {
     return ret;
   }
@@ -425,12 +432,12 @@ int RGWSystemMetaObj::read_default_id(string& default_id, bool old_format)
   return 0;
 }
 
-int RGWSystemMetaObj::use_default(bool old_format)
+int RGWSystemMetaObj::use_default(optional_yield y, bool old_format)
 {
-  return read_default_id(id, old_format);
+  return read_default_id(id, y, old_format);
 }
 
-int RGWSystemMetaObj::set_as_default(bool exclusive)
+int RGWSystemMetaObj::set_as_default(optional_yield y, bool exclusive)
 {
   using ceph::encode;
   string oid  = get_default_oid();
@@ -447,14 +454,15 @@ int RGWSystemMetaObj::set_as_default(bool exclusive)
   auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj(pool, oid));
   int ret = sysobj.wop()
                   .set_exclusive(exclusive)
-                  .write(bl, null_yield);
+                  .write(bl, y);
   if (ret < 0)
     return ret;
 
   return 0;
 }
 
-int RGWSystemMetaObj::read_id(const string& obj_name, string& object_id)
+int RGWSystemMetaObj::read_id(const string& obj_name, string& object_id,
+                             optional_yield y)
 {
   using ceph::decode;
   rgw_pool pool(get_pool(cct));
@@ -464,7 +472,7 @@ int RGWSystemMetaObj::read_id(const string& obj_name, string& object_id)
 
   auto obj_ctx = sysobj_svc->init_obj_ctx();
   auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj(pool, oid));
-  int ret = sysobj.rop().read(&bl, null_yield);
+  int ret = sysobj.rop().read(&bl, y);
   if (ret < 0) {
     return ret;
   }
@@ -481,7 +489,7 @@ int RGWSystemMetaObj::read_id(const string& obj_name, string& object_id)
   return 0;
 }
 
-int RGWSystemMetaObj::delete_obj(bool old_format)
+int RGWSystemMetaObj::delete_obj(optional_yield y, bool old_format)
 {
   rgw_pool pool(get_pool(cct));
 
@@ -489,14 +497,14 @@ int RGWSystemMetaObj::delete_obj(bool old_format)
 
   /* check to see if obj is the default */
   RGWDefaultSystemMetaObjInfo default_info;
-  int ret = read_default(default_info, get_default_oid(old_format));
+  int ret = read_default(default_info, get_default_oid(old_format), y);
   if (ret < 0 && ret != -ENOENT)
     return ret;
   if (default_info.default_id == id || (old_format && default_info.default_id == name)) {
     string oid = get_default_oid(old_format);
     rgw_raw_obj default_named_obj(pool, oid);
     auto sysobj = sysobj_svc->get_obj(obj_ctx, default_named_obj);
-    ret = sysobj.wop().remove(null_yield);
+    ret = sysobj.wop().remove(y);
     if (ret < 0) {
       ldout(cct, 0) << "Error delete default obj name  " << name << ": " << cpp_strerror(-ret) << dendl;
       return ret;
@@ -506,7 +514,7 @@ int RGWSystemMetaObj::delete_obj(bool old_format)
     string oid  = get_names_oid_prefix() + name;
     rgw_raw_obj object_name(pool, oid);
     auto sysobj = sysobj_svc->get_obj(obj_ctx, object_name);
-    ret = sysobj.wop().remove(null_yield);
+    ret = sysobj.wop().remove(y);
     if (ret < 0) {
       ldout(cct, 0) << "Error delete obj name  " << name << ": " << cpp_strerror(-ret) << dendl;
       return ret;
@@ -522,7 +530,7 @@ int RGWSystemMetaObj::delete_obj(bool old_format)
 
   rgw_raw_obj object_id(pool, oid);
   auto sysobj = sysobj_svc->get_obj(obj_ctx, object_id);
-  ret = sysobj.wop().remove(null_yield);
+  ret = sysobj.wop().remove(y);
   if (ret < 0) {
     ldout(cct, 0) << "Error delete object id " << id << ": " << cpp_strerror(-ret) << dendl;
   }
@@ -530,7 +538,7 @@ int RGWSystemMetaObj::delete_obj(bool old_format)
   return ret;
 }
 
-int RGWSystemMetaObj::store_name(bool exclusive)
+int RGWSystemMetaObj::store_name(bool exclusive, optional_yield y)
 {
   rgw_pool pool(get_pool(cct));
   string oid = get_names_oid_prefix() + name;
@@ -545,13 +553,13 @@ int RGWSystemMetaObj::store_name(bool exclusive)
   auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj(pool, oid));
   return sysobj.wop()
                .set_exclusive(exclusive)
-               .write(bl, null_yield);
+               .write(bl, y);
 }
 
-int RGWSystemMetaObj::rename(const string& new_name)
+int RGWSystemMetaObj::rename(const string& new_name, optional_yield y)
 {
   string new_id;
-  int ret = read_id(new_name, new_id);
+  int ret = read_id(new_name, new_id, y);
   if (!ret) {
     return -EEXIST;
   }
@@ -561,12 +569,12 @@ int RGWSystemMetaObj::rename(const string& new_name)
   }
   string old_name = name;
   name = new_name;
-  ret = update();
+  ret = update(y);
   if (ret < 0) {
     ldout(cct, 0) << "Error storing new obj info " << new_name << ": " << cpp_strerror(-ret) << dendl;
     return ret;
   }
-  ret = store_name(true);
+  ret = store_name(true, y);
   if (ret < 0) {
     ldout(cct, 0) << "Error storing new name " << new_name << ": " << cpp_strerror(-ret) << dendl;
     return ret;
@@ -577,7 +585,7 @@ int RGWSystemMetaObj::rename(const string& new_name)
   rgw_raw_obj old_name_obj(pool, oid);
   auto obj_ctx = sysobj_svc->init_obj_ctx();
   auto sysobj = sysobj_svc->get_obj(obj_ctx, old_name_obj);
-  ret = sysobj.wop().remove(null_yield);
+  ret = sysobj.wop().remove(y);
   if (ret < 0) {
     ldout(cct, 0) << "Error delete old obj name  " << old_name << ": " << cpp_strerror(-ret) << dendl;
     return ret;
@@ -586,7 +594,8 @@ int RGWSystemMetaObj::rename(const string& new_name)
   return ret;
 }
 
-int RGWSystemMetaObj::read_info(const string& obj_id, bool old_format)
+int RGWSystemMetaObj::read_info(const string& obj_id, optional_yield y,
+                               bool old_format)
 {
   rgw_pool pool(get_pool(cct));
 
@@ -596,7 +605,7 @@ int RGWSystemMetaObj::read_info(const string& obj_id, bool old_format)
 
   auto obj_ctx = sysobj_svc->init_obj_ctx();
   auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj{pool, oid});
-  int ret = sysobj.rop().read(&bl, null_yield);
+  int ret = sysobj.rop().read(&bl, y);
   if (ret < 0) {
     ldout(cct, 0) << "failed reading obj info from " << pool << ":" << oid << ": " << cpp_strerror(-ret) << dendl;
     return ret;
@@ -614,22 +623,22 @@ int RGWSystemMetaObj::read_info(const string& obj_id, bool old_format)
   return 0;
 }
 
-int RGWSystemMetaObj::read()
+int RGWSystemMetaObj::read(optional_yield y)
 {
-  int ret = read_id(name, id);
+  int ret = read_id(name, id, y);
   if (ret < 0) {
     return ret;
   }
 
-  return read_info(id);
+  return read_info(id, y);
 }
 
-int RGWSystemMetaObj::create(bool exclusive)
+int RGWSystemMetaObj::create(optional_yield y, bool exclusive)
 {
   int ret;
-  
+
   /* check to see the name is not used */
-  ret = read_id(name, id);
+  ret = read_id(name, id, y);
   if (exclusive && ret == 0) {
     ldout(cct, 10) << "ERROR: name " << name << " already in use for obj id " << id << dendl;
     return -EEXIST;
@@ -647,16 +656,16 @@ int RGWSystemMetaObj::create(bool exclusive)
     id = uuid_str;
   }
 
-  ret = store_info(exclusive);
+  ret = store_info(exclusive, y);
   if (ret < 0) {
     ldout(cct, 0) << "ERROR:  storing info for " << id << ": " << cpp_strerror(-ret) << dendl;
     return ret;
   }
 
-  return store_name(exclusive);
+  return store_name(exclusive, y);
 }
 
-int RGWSystemMetaObj::store_info(bool exclusive)
+int RGWSystemMetaObj::store_info(bool exclusive, optional_yield y)
 {
   rgw_pool pool(get_pool(cct));
 
@@ -669,17 +678,17 @@ int RGWSystemMetaObj::store_info(bool exclusive)
   auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj{pool, oid});
   return sysobj.wop()
                .set_exclusive(exclusive)
-               .write(bl, null_yield);
+               .write(bl, y);
 }
 
-int RGWSystemMetaObj::write(bool exclusive)
+int RGWSystemMetaObj::write(bool exclusive, optional_yield y)
 {
-  int ret = store_info(exclusive);
+  int ret = store_info(exclusive, y);
   if (ret < 0) {
     ldout(cct, 20) << __func__ << "(): store_info() returned ret=" << ret << dendl;
     return ret;
   }
-  ret = store_name(exclusive);
+  ret = store_name(exclusive, y);
   if (ret < 0) {
     ldout(cct, 20) << __func__ << "(): store_name() returned ret=" << ret << dendl;
     return ret;
@@ -692,15 +701,15 @@ const string& RGWRealm::get_predefined_name(CephContext *cct) const {
   return cct->_conf->rgw_realm;
 }
 
-int RGWRealm::create(bool exclusive)
+int RGWRealm::create(optional_yield y, bool exclusive)
 {
-  int ret = RGWSystemMetaObj::create(exclusive);
+  int ret = RGWSystemMetaObj::create(y, exclusive);
   if (ret < 0) {
     ldout(cct, 0) << "ERROR creating new realm object " << name << ": " << cpp_strerror(-ret) << dendl;
     return ret;
   }
   // create the control object for watch/notify
-  ret = create_control(exclusive);
+  ret = create_control(exclusive, y);
   if (ret < 0) {
     ldout(cct, 0) << "ERROR creating control for new realm " << name << ": " << cpp_strerror(-ret) << dendl;
     return ret;
@@ -708,31 +717,31 @@ int RGWRealm::create(bool exclusive)
   RGWPeriod period;
   if (current_period.empty()) {
     /* create new period for the realm */
-    ret = period.init(cct, sysobj_svc, id, name, false);
+    ret = period.init(cct, sysobj_svc, id, y, name, false);
     if (ret < 0 ) {
       return ret;
     }
-    ret = period.create(true);
+    ret = period.create(y, true);
     if (ret < 0) {
       ldout(cct, 0) << "ERROR: creating new period for realm " << name << ": " << cpp_strerror(-ret) << dendl;
       return ret;
     }
   } else {
     period = RGWPeriod(current_period, 0);
-    int ret = period.init(cct, sysobj_svc, id, name);
+    int ret = period.init(cct, sysobj_svc, id, y, name);
     if (ret < 0) {
       ldout(cct, 0) << "ERROR: failed to init period " << current_period << dendl;
       return ret;
     }
   }
-  ret = set_current_period(period);
+  ret = set_current_period(period, y);
   if (ret < 0) {
     ldout(cct, 0) << "ERROR: failed set current period " << current_period << dendl;
     return ret;
   }
   // try to set as default. may race with another create, so pass exclusive=true
   // so we don't override an existing default
-  ret = set_as_default(true);
+  ret = set_as_default(y, true);
   if (ret < 0 && ret != -EEXIST) {
     ldout(cct, 0) << "WARNING: failed to set realm as default realm, ret=" << ret << dendl;
   }
@@ -740,16 +749,16 @@ int RGWRealm::create(bool exclusive)
   return 0;
 }
 
-int RGWRealm::delete_obj()
+int RGWRealm::delete_obj(optional_yield y)
 {
-  int ret = RGWSystemMetaObj::delete_obj();
+  int ret = RGWSystemMetaObj::delete_obj(y);
   if (ret < 0) {
     return ret;
   }
-  return delete_control();
+  return delete_control(y);
 }
 
-int RGWRealm::create_control(bool exclusive)
+int RGWRealm::create_control(bool exclusive, optional_yield y)
 {
   auto pool = rgw_pool{get_pool(cct)};
   auto oid = get_control_oid();
@@ -758,16 +767,16 @@ int RGWRealm::create_control(bool exclusive)
   auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj{pool, oid});
   return sysobj.wop()
                .set_exclusive(exclusive)
-               .write(bl, null_yield);
+               .write(bl, y);
 }
 
-int RGWRealm::delete_control()
+int RGWRealm::delete_control(optional_yield y)
 {
   auto pool = rgw_pool{get_pool(cct)};
   auto obj = rgw_raw_obj{pool, get_control_oid()};
   auto obj_ctx = sysobj_svc->init_obj_ctx();
   auto sysobj = sysobj_svc->get_obj(obj_ctx, obj);
-  return sysobj.wop().remove(null_yield);
+  return sysobj.wop().remove(y);
 }
 
 rgw_pool RGWRealm::get_pool(CephContext *cct) const
@@ -796,7 +805,7 @@ const string& RGWRealm::get_info_oid_prefix(bool old_format) const
   return realm_info_oid_prefix;
 }
 
-int RGWRealm::set_current_period(RGWPeriod& period)
+int RGWRealm::set_current_period(RGWPeriod& period, optional_yield y)
 {
   // update realm epoch to match the period's
   if (epoch > period.get_realm_epoch()) {
@@ -814,13 +823,13 @@ int RGWRealm::set_current_period(RGWPeriod& period)
   epoch = period.get_realm_epoch();
   current_period = period.get_id();
 
-  int ret = update();
+  int ret = update(y);
   if (ret < 0) {
     ldout(cct, 0) << "ERROR: period update: " << cpp_strerror(-ret) << dendl;
     return ret;
   }
 
-  ret = period.reflect();
+  ret = period.reflect(y);
   if (ret < 0) {
     ldout(cct, 0) << "ERROR: period.reflect(): " << cpp_strerror(-ret) << dendl;
     return ret;
@@ -834,19 +843,19 @@ string RGWRealm::get_control_oid() const
   return get_info_oid_prefix() + id + ".control";
 }
 
-int RGWRealm::notify_zone(bufferlist& bl)
+int RGWRealm::notify_zone(bufferlist& bl, optional_yield y)
 {
   rgw_pool pool{get_pool(cct)};
   auto obj_ctx = sysobj_svc->init_obj_ctx();
   auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj{pool, get_control_oid()});
-  int ret = sysobj.wn().notify(bl, 0, nullptr, null_yield);
+  int ret = sysobj.wn().notify(bl, 0, nullptr, y);
   if (ret < 0) {
     return ret;
   }
   return 0;
 }
 
-int RGWRealm::notify_new_period(const RGWPeriod& period)
+int RGWRealm::notify_new_period(const RGWPeriod& period, optional_yield y)
 {
   bufferlist bl;
   using ceph::encode;
@@ -856,7 +865,7 @@ int RGWRealm::notify_new_period(const RGWPeriod& period)
   // reload the gateway with the new period
   encode(RGWRealmNotify::Reload, bl);
 
-  return notify_zone(bl);
+  return notify_zone(bl, y);
 }
 
 std::string RGWPeriodConfig::get_oid(const std::string& realm_id)
@@ -876,7 +885,8 @@ rgw_pool RGWPeriodConfig::get_pool(CephContext *cct)
   return {pool_name};
 }
 
-int RGWPeriodConfig::read(RGWSI_SysObj *sysobj_svc, const std::string& realm_id)
+int RGWPeriodConfig::read(RGWSI_SysObj *sysobj_svc, const std::string& realm_id,
+                         optional_yield y)
 {
   const auto& pool = get_pool(sysobj_svc->ctx());
   const auto& oid = get_oid(realm_id);
@@ -884,7 +894,7 @@ int RGWPeriodConfig::read(RGWSI_SysObj *sysobj_svc, const std::string& realm_id)
 
   auto obj_ctx = sysobj_svc->init_obj_ctx();
   auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj{pool, oid});
-  int ret = sysobj.rop().read(&bl, null_yield);
+  int ret = sysobj.rop().read(&bl, y);
   if (ret < 0) {
     return ret;
   }
@@ -898,7 +908,8 @@ int RGWPeriodConfig::read(RGWSI_SysObj *sysobj_svc, const std::string& realm_id)
   return 0;
 }
 
-int RGWPeriodConfig::write(RGWSI_SysObj *sysobj_svc, const std::string& realm_id)
+int RGWPeriodConfig::write(RGWSI_SysObj *sysobj_svc,
+                          const std::string& realm_id, optional_yield y)
 {
   const auto& pool = get_pool(sysobj_svc->ctx());
   const auto& oid = get_oid(realm_id);
@@ -909,10 +920,11 @@ int RGWPeriodConfig::write(RGWSI_SysObj *sysobj_svc, const std::string& realm_id
   auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj{pool, oid});
   return sysobj.wop()
                .set_exclusive(false)
-               .write(bl, null_yield);
+               .write(bl, y);
 }
 
-int RGWPeriod::init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, const string& period_realm_id,
+int RGWPeriod::init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc,
+                   const string& period_realm_id, optional_yield y,
                    const string& period_realm_name, bool setup_obj)
 {
   cct = _cct;
@@ -924,11 +936,12 @@ int RGWPeriod::init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, const string&
   if (!setup_obj)
     return 0;
 
-  return init(_cct, _sysobj_svc, setup_obj);
+  return init(_cct, _sysobj_svc, y, setup_obj);
 }
 
 
-int RGWPeriod::init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, bool setup_obj)
+int RGWPeriod::init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc,
+                   optional_yield y, bool setup_obj)
 {
   cct = _cct;
   sysobj_svc = _sysobj_svc;
@@ -938,7 +951,7 @@ int RGWPeriod::init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, bool setup_obj
 
   if (id.empty()) {
     RGWRealm realm(realm_id, realm_name);
-    int ret = realm.init(cct, sysobj_svc);
+    int ret = realm.init(cct, sysobj_svc, y);
     if (ret < 0) {
       ldout(cct, 0) << "RGWPeriod::init failed to init realm " << realm_name  << " id " << realm_id << " : " <<
        cpp_strerror(-ret) << dendl;
@@ -949,7 +962,7 @@ int RGWPeriod::init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, bool setup_obj
   }
 
   if (!epoch) {
-    int ret = use_latest_epoch();
+    int ret = use_latest_epoch(y);
     if (ret < 0) {
       ldout(cct, 0) << "failed to use_latest_epoch period id " << id << " realm " << realm_name  << " id " << realm_id
           << " : " << cpp_strerror(-ret) << dendl;
@@ -957,7 +970,7 @@ int RGWPeriod::init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, bool setup_obj
     }
   }
 
-  return read_info();
+  return read_info(y);
 }
 
 
@@ -1007,6 +1020,7 @@ const string RGWPeriod::get_period_oid() const
 }
 
 int RGWPeriod::read_latest_epoch(RGWPeriodLatestEpochInfo& info,
+                                optional_yield y,
                                  RGWObjVersionTracker *objv)
 {
   string oid = get_period_oid_prefix() + get_latest_epoch_oid();
@@ -1015,7 +1029,7 @@ int RGWPeriod::read_latest_epoch(RGWPeriodLatestEpochInfo& info,
   bufferlist bl;
   auto obj_ctx = sysobj_svc->init_obj_ctx();
   auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj{pool, oid});
-  int ret = sysobj.rop().read(&bl, null_yield);
+  int ret = sysobj.rop().read(&bl, y);
   if (ret < 0) {
     ldout(cct, 1) << "error read_lastest_epoch " << pool << ":" << oid << dendl;
     return ret;
@@ -1032,11 +1046,11 @@ int RGWPeriod::read_latest_epoch(RGWPeriodLatestEpochInfo& info,
   return 0;
 }
 
-int RGWPeriod::get_latest_epoch(epoch_t& latest_epoch)
+int RGWPeriod::get_latest_epoch(epoch_t& latest_epoch, optional_yield y)
 {
   RGWPeriodLatestEpochInfo info;
 
-  int ret = read_latest_epoch(info);
+  int ret = read_latest_epoch(info, y);
   if (ret < 0) {
     return ret;
   }
@@ -1046,10 +1060,10 @@ int RGWPeriod::get_latest_epoch(epoch_t& latest_epoch)
   return 0;
 }
 
-int RGWPeriod::use_latest_epoch()
+int RGWPeriod::use_latest_epoch(optional_yield y)
 {
   RGWPeriodLatestEpochInfo info;
-  int ret = read_latest_epoch(info);
+  int ret = read_latest_epoch(info, y);
   if (ret < 0) {
     return ret;
   }
@@ -1059,7 +1073,8 @@ int RGWPeriod::use_latest_epoch()
   return 0;
 }
 
-int RGWPeriod::set_latest_epoch(epoch_t epoch, bool exclusive,
+int RGWPeriod::set_latest_epoch(optional_yield y,
+                               epoch_t epoch, bool exclusive,
                                 RGWObjVersionTracker *objv)
 {
   string oid = get_period_oid_prefix() + get_latest_epoch_oid();
@@ -1077,10 +1092,10 @@ int RGWPeriod::set_latest_epoch(epoch_t epoch, bool exclusive,
   auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj(pool, oid));
   return sysobj.wop()
                .set_exclusive(exclusive)
-               .write(bl, null_yield);
+               .write(bl, y);
 }
 
-int RGWPeriod::update_latest_epoch(epoch_t epoch)
+int RGWPeriod::update_latest_epoch(epoch_t epoch, optional_yield y)
 {
   static constexpr int MAX_RETRIES = 20;
 
@@ -1090,7 +1105,7 @@ int RGWPeriod::update_latest_epoch(epoch_t epoch)
     bool exclusive = false;
 
     // read existing epoch
-    int r = read_latest_epoch(info, &objv);
+    int r = read_latest_epoch(info, y, &objv);
     if (r == -ENOENT) {
       // use an exclusive create to set the epoch atomically
       exclusive = true;
@@ -1109,7 +1124,7 @@ int RGWPeriod::update_latest_epoch(epoch_t epoch)
           << " -> " << epoch << " on period=" << id << dendl;
     }
 
-    r = set_latest_epoch(epoch, exclusive, &objv);
+    r = set_latest_epoch(y, epoch, exclusive, &objv);
     if (r == -EEXIST) {
       continue; // exclusive create raced with another update, retry
     } else if (r == -ECANCELED) {
@@ -1125,7 +1140,7 @@ int RGWPeriod::update_latest_epoch(epoch_t epoch)
   return -ECANCELED; // fail after max retries
 }
 
-int RGWPeriod::delete_obj()
+int RGWPeriod::delete_obj(optional_yield y)
 {
   rgw_pool pool(get_pool(cct));
 
@@ -1135,7 +1150,7 @@ int RGWPeriod::delete_obj()
     rgw_raw_obj oid{pool, p.get_period_oid()};
     auto obj_ctx = sysobj_svc->init_obj_ctx();
     auto sysobj = sysobj_svc->get_obj(obj_ctx, oid);
-    int ret = sysobj.wop().remove(null_yield);
+    int ret = sysobj.wop().remove(y);
     if (ret < 0) {
       ldout(cct, 0) << "WARNING: failed to delete period object " << oid
           << ": " << cpp_strerror(-ret) << dendl;
@@ -1146,7 +1161,7 @@ int RGWPeriod::delete_obj()
   rgw_raw_obj oid{pool, get_period_oid_prefix() + get_latest_epoch_oid()};
   auto obj_ctx = sysobj_svc->init_obj_ctx();
   auto sysobj = sysobj_svc->get_obj(obj_ctx, oid);
-  int ret = sysobj.wop().remove(null_yield);
+  int ret = sysobj.wop().remove(y);
   if (ret < 0) {
     ldout(cct, 0) << "WARNING: failed to delete period object " << oid
         << ": " << cpp_strerror(-ret) << dendl;
@@ -1154,7 +1169,7 @@ int RGWPeriod::delete_obj()
   return ret;
 }
 
-int RGWPeriod::read_info()
+int RGWPeriod::read_info(optional_yield y)
 {
   rgw_pool pool(get_pool(cct));
 
@@ -1162,7 +1177,7 @@ int RGWPeriod::read_info()
 
   auto obj_ctx = sysobj_svc->init_obj_ctx();
   auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj{pool, get_period_oid()});
-  int ret = sysobj.rop().read(&bl, null_yield);
+  int ret = sysobj.rop().read(&bl, y);
   if (ret < 0) {
     ldout(cct, 0) << "failed reading obj info from " << pool << ":" << get_period_oid() << ": " << cpp_strerror(-ret) << dendl;
     return ret;
@@ -1180,7 +1195,7 @@ int RGWPeriod::read_info()
   return 0;
 }
 
-int RGWPeriod::create(bool exclusive)
+int RGWPeriod::create(optional_yield y, bool exclusive)
 {
   int ret;
   
@@ -1194,14 +1209,14 @@ int RGWPeriod::create(bool exclusive)
   epoch = FIRST_EPOCH;
 
   period_map.id = id;
-  
-  ret = store_info(exclusive);
+
+  ret = store_info(exclusive, y);
   if (ret < 0) {
     ldout(cct, 0) << "ERROR:  storing info for " << id << ": " << cpp_strerror(-ret) << dendl;
     return ret;
   }
 
-  ret = set_latest_epoch(epoch);
+  ret = set_latest_epoch(y, epoch);
   if (ret < 0) {
     ldout(cct, 0) << "ERROR: setting latest epoch " << id << ": " << cpp_strerror(-ret) << dendl;
   }
@@ -1209,7 +1224,7 @@ int RGWPeriod::create(bool exclusive)
   return ret;
 }
 
-int RGWPeriod::store_info(bool exclusive)
+int RGWPeriod::store_info(bool exclusive, optional_yield y)
 {
   rgw_pool pool(get_pool(cct));
 
@@ -1222,7 +1237,7 @@ int RGWPeriod::store_info(bool exclusive)
   auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj(pool, oid));
   return sysobj.wop()
                .set_exclusive(exclusive)
-               .write(bl, null_yield);
+               .write(bl, y);
 }
 
 rgw_pool RGWPeriod::get_pool(CephContext *cct) const
@@ -1233,7 +1248,7 @@ rgw_pool RGWPeriod::get_pool(CephContext *cct) const
   return rgw_pool(cct->_conf->rgw_period_root_pool);
 }
 
-int RGWPeriod::add_zonegroup(const RGWZoneGroup& zonegroup)
+int RGWPeriod::add_zonegroup(const RGWZoneGroup& zonegroup, optional_yield y)
 {
   if (zonegroup.realm_id != realm_id) {
     return 0;
@@ -1244,10 +1259,10 @@ int RGWPeriod::add_zonegroup(const RGWZoneGroup& zonegroup)
     return ret;
   }
 
-  return store_info(false);
+  return store_info(false, y);
 }
 
-int RGWPeriod::update()
+int RGWPeriod::update(optional_yield y)
 {
   auto zone_svc = sysobj_svc->get_zone_svc();
   ldout(cct, 20) << __func__ << " realm " << realm_id << " period " << get_id() << dendl;
@@ -1264,7 +1279,7 @@ int RGWPeriod::update()
 
   for (auto& iter : zonegroups) {
     RGWZoneGroup zg(string(), iter);
-    ret = zg.init(cct, sysobj_svc);
+    ret = zg.init(cct, sysobj_svc, y);
     if (ret < 0) {
       ldout(cct, 0) << "WARNING: zg.init() failed: " << cpp_strerror(-ret) << dendl;
       continue;
@@ -1297,7 +1312,7 @@ int RGWPeriod::update()
     }
   }
 
-  ret = period_config.read(sysobj_svc, realm_id);
+  ret = period_config.read(sysobj_svc, realm_id, y);
   if (ret < 0 && ret != -ENOENT) {
     ldout(cct, 0) << "ERROR: failed to read period config: "
         << cpp_strerror(ret) << dendl;
@@ -1306,19 +1321,19 @@ int RGWPeriod::update()
   return 0;
 }
 
-int RGWPeriod::reflect()
+int RGWPeriod::reflect(optional_yield y)
 {
   for (auto& iter : period_map.zonegroups) {
     RGWZoneGroup& zg = iter.second;
     zg.reinit_instance(cct, sysobj_svc);
-    int r = zg.write(false);
+    int r = zg.write(false, y);
     if (r < 0) {
       ldout(cct, 0) << "ERROR: failed to store zonegroup info for zonegroup=" << iter.first << ": " << cpp_strerror(-r) << dendl;
       return r;
     }
     if (zg.is_master_zonegroup()) {
       // set master as default if no default exists
-      r = zg.set_as_default(true);
+      r = zg.set_as_default(y, true);
       if (r == 0) {
         ldout(cct, 1) << "Set the period's master zonegroup " << zg.get_id()
             << " as the default" << dendl;
@@ -1326,7 +1341,7 @@ int RGWPeriod::reflect()
     }
   }
 
-  int r = period_config.write(sysobj_svc, realm_id);
+  int r = period_config.write(sysobj_svc, realm_id, y);
   if (r < 0) {
     ldout(cct, 0) << "ERROR: failed to store period config: "
         << cpp_strerror(-r) << dendl;
@@ -1409,7 +1424,8 @@ int RGWPeriod::update_sync_status(rgw::sal::RGWRadosStore *store, /* for now */
 
 int RGWPeriod::commit(rgw::sal::RGWRadosStore *store,
                      RGWRealm& realm, const RGWPeriod& current_period,
-                      std::ostream& error_stream, bool force_if_stale)
+                      std::ostream& error_stream, optional_yield y,
+                     bool force_if_stale)
 {
   auto zone_svc = sysobj_svc->get_zone_svc();
   ldout(cct, 20) << __func__ << " realm " << realm.get_id() << " period " << current_period.get_id() << dendl;
@@ -1447,13 +1463,13 @@ int RGWPeriod::commit(rgw::sal::RGWRadosStore *store,
       return r;
     }
     // create an object with a new period id
-    r = create(true);
+    r = create(y, true);
     if (r < 0) {
       ldout(cct, 0) << "failed to create new period: " << cpp_strerror(-r) << dendl;
       return r;
     }
     // set as current period
-    r = realm.set_current_period(*this);
+    r = realm.set_current_period(*this, y);
     if (r < 0) {
       ldout(cct, 0) << "failed to update realm's current period: "
           << cpp_strerror(-r) << dendl;
@@ -1461,7 +1477,7 @@ int RGWPeriod::commit(rgw::sal::RGWRadosStore *store,
     }
     ldout(cct, 4) << "Promoted to master zone and committed new period "
         << id << dendl;
-    realm.notify_new_period(*this);
+    realm.notify_new_period(*this, y);
     return 0;
   }
   // period must be based on current epoch
@@ -1478,13 +1494,13 @@ int RGWPeriod::commit(rgw::sal::RGWRadosStore *store,
   set_predecessor(current_period.get_predecessor());
   realm_epoch = current_period.get_realm_epoch();
   // write the period to rados
-  int r = store_info(false);
+  int r = store_info(false, y);
   if (r < 0) {
     ldout(cct, 0) << "failed to store period: " << cpp_strerror(-r) << dendl;
     return r;
   }
   // set as latest epoch
-  r = update_latest_epoch(epoch);
+  r = update_latest_epoch(epoch, y);
   if (r == -EEXIST) {
     // already have this epoch (or a more recent one)
     return 0;
@@ -1493,22 +1509,22 @@ int RGWPeriod::commit(rgw::sal::RGWRadosStore *store,
     ldout(cct, 0) << "failed to set latest epoch: " << cpp_strerror(-r) << dendl;
     return r;
   }
-  r = reflect();
+  r = reflect(y);
   if (r < 0) {
     ldout(cct, 0) << "failed to update local objects: " << cpp_strerror(-r) << dendl;
     return r;
   }
   ldout(cct, 4) << "Committed new epoch " << epoch
       << " for period " << id << dendl;
-  realm.notify_new_period(*this);
+  realm.notify_new_period(*this, y);
   return 0;
 }
 
-int RGWZoneParams::create_default(bool old_format)
+int RGWZoneParams::create_default(optional_yield y, bool old_format)
 {
   name = default_zone_name;
 
-  int r = create();
+  int r = create(y);
   if (r < 0) {
     return r;
   }
@@ -1521,15 +1537,17 @@ int RGWZoneParams::create_default(bool old_format)
 }
 
 
+namespace {
 int get_zones_pool_set(CephContext* cct,
                        RGWSI_SysObj* sysobj_svc,
                        const list<string>& zones,
                        const string& my_zone_id,
-                       set<rgw_pool>& pool_names)
+                       set<rgw_pool>& pool_names,
+                      optional_yield y)
 {
   for(auto const& iter : zones) {
     RGWZoneParams zone(iter);
-    int r = zone.init(cct, sysobj_svc);
+    int r = zone.init(cct, sysobj_svc, y);
     if (r < 0) {
       ldout(cct, 0) << "Error: init zone " << iter << ":" << cpp_strerror(-r) << dendl;
       return r;
@@ -1592,8 +1610,9 @@ rgw_pool fix_zone_pool_dup(set<rgw_pool> pools,
     }
   }  
 }
+}
 
-int RGWZoneParams::fix_pool_names()
+int RGWZoneParams::fix_pool_names(optional_yield y)
 {
 
   list<string> zones;
@@ -1603,7 +1622,7 @@ int RGWZoneParams::fix_pool_names()
   }
 
   set<rgw_pool> pools;
-  r = get_zones_pool_set(cct, sysobj_svc, zones, id, pools);
+  r = get_zones_pool_set(cct, sysobj_svc, zones, id, pools, y);
   if (r < 0) {
     ldout(cct, 0) << "Error: get_zones_pool_names" << r << dendl;
     return r;
@@ -1643,13 +1662,13 @@ int RGWZoneParams::fix_pool_names()
   return 0;
 }
 
-int RGWZoneParams::create(bool exclusive)
+int RGWZoneParams::create(optional_yield y, bool exclusive)
 {
   /* check for old pools config */
   rgw_raw_obj obj(domain_root, avail_pools);
   auto obj_ctx = sysobj_svc->init_obj_ctx();
   auto sysobj = sysobj_svc->get_obj(obj_ctx, obj);
-  int r = sysobj.rop().stat(null_yield);
+  int r = sysobj.rop().stat(y);
   if (r < 0) {
     ldout(cct, 10) << "couldn't find old data placement pools config, setting up new ones for the zone" << dendl;
     /* a new system, let's set new placement info */
@@ -1661,20 +1680,20 @@ int RGWZoneParams::create(bool exclusive)
     placement_pools["default-placement"] = default_placement;
   }
 
-  r = fix_pool_names();
+  r = fix_pool_names(y);
   if (r < 0) {
     ldout(cct, 0) << "ERROR: fix_pool_names returned r=" << r << dendl;
     return r;
   }
 
-  r = RGWSystemMetaObj::create(exclusive);
+  r = RGWSystemMetaObj::create(y, exclusive);
   if (r < 0) {
     return r;
   }
 
   // try to set as default. may race with another create, so pass exclusive=true
   // so we don't override an existing default
-  r = set_as_default(true);
+  r = set_as_default(y, true);
   if (r < 0 && r != -EEXIST) {
     ldout(cct, 10) << "WARNING: failed to set zone as default, r=" << r << dendl;
   }
@@ -1714,38 +1733,40 @@ const string& RGWZoneParams::get_predefined_name(CephContext *cct) const {
   return cct->_conf->rgw_zone;
 }
 
-int RGWZoneParams::init(CephContext *cct, RGWSI_SysObj *sysobj_svc, bool setup_obj, bool old_format)
+int RGWZoneParams::init(CephContext *cct, RGWSI_SysObj *sysobj_svc,
+                       optional_yield y, bool setup_obj, bool old_format)
 {
   if (name.empty()) {
     name = cct->_conf->rgw_zone;
   }
 
-  return RGWSystemMetaObj::init(cct, sysobj_svc, setup_obj, old_format);
+  return RGWSystemMetaObj::init(cct, sysobj_svc, y, setup_obj, old_format);
 }
 
-int RGWZoneParams::read_default_id(string& default_id, bool old_format)
+int RGWZoneParams::read_default_id(string& default_id, optional_yield y,
+                                  bool old_format)
 {
   if (realm_id.empty()) {
     /* try using default realm */
     RGWRealm realm;
-    int ret = realm.init(cct, sysobj_svc);
+    int ret = realm.init(cct, sysobj_svc, y);
     //no default realm exist
     if (ret < 0) {
-      return read_id(default_zone_name, default_id);
+      return read_id(default_zone_name, default_id, y);
     }
     realm_id = realm.get_id();
   }
 
-  return RGWSystemMetaObj::read_default_id(default_id, old_format);
+  return RGWSystemMetaObj::read_default_id(default_id, y, old_format);
 }
 
 
-int RGWZoneParams::set_as_default(bool exclusive)
+int RGWZoneParams::set_as_default(optional_yield y, bool exclusive)
 {
   if (realm_id.empty()) {
     /* try using default realm */
     RGWRealm realm;
-    int ret = realm.init(cct, sysobj_svc);
+    int ret = realm.init(cct, sysobj_svc, y);
     if (ret < 0) {
       ldout(cct, 10) << "could not read realm id: " << cpp_strerror(-ret) << dendl;
       return -EINVAL;
@@ -1753,7 +1774,7 @@ int RGWZoneParams::set_as_default(bool exclusive)
     realm_id = realm.get_id();
   }
 
-  return RGWSystemMetaObj::set_as_default(exclusive);
+  return RGWSystemMetaObj::set_as_default(y, exclusive);
 }
 
 const string& RGWZoneParams::get_compression_type(const rgw_placement_rule& placement_rule) const
@@ -1869,16 +1890,16 @@ uint32_t RGWPeriodMap::get_zone_short_id(const string& zone_id) const
   return i->second;
 }
 
-int RGWZoneGroupMap::read(CephContext *cct, RGWSI_SysObj *sysobj_svc)
+int RGWZoneGroupMap::read(CephContext *cct, RGWSI_SysObj *sysobj_svc, optional_yield y)
 {
 
   RGWPeriod period;
-  int ret = period.init(cct, sysobj_svc);
+  int ret = period.init(cct, sysobj_svc, y);
   if (ret < 0) {
     cerr << "failed to read current period info: " << cpp_strerror(ret);
     return ret;
   }
-       
+
   bucket_quota = period.get_config().bucket_quota;
   user_quota = period.get_config().user_quota;
   zonegroups = period.get_map().zonegroups;
index 430d5dfe9552e4db411ae6280df5f237b10a4382..32a588aea2adb62a62d72870b516c1257491d83d 100644 (file)
@@ -86,14 +86,15 @@ protected:
   RGWSI_SysObj *sysobj_svc{nullptr};
   RGWSI_Zone *zone_svc{nullptr};
 
-  int store_name(bool exclusive);
-  int store_info(bool exclusive);
-  int read_info(const std::string& obj_id, bool old_format = false);
-  int read_id(const std::string& obj_name, std::string& obj_id);
+  int store_name(bool exclusive, optional_yield y);
+  int store_info(bool exclusive, optional_yield y);
+  int read_info(const std::string& obj_id, optional_yield y, bool old_format = false);
+  int read_id(const std::string& obj_name, std::string& obj_id, optional_yield y);
   int read_default(RGWDefaultSystemMetaObjInfo& default_info,
-                  const std::string& oid);
+                  const std::string& oid,
+                  optional_yield y);
   /* read and use default id */
-  int use_default(bool old_format = false);
+  int use_default(optional_yield y, bool old_format = false);
 
 public:
   RGWSystemMetaObj() {}
@@ -130,17 +131,20 @@ public:
   }
 
   void reinit_instance(CephContext *_cct, RGWSI_SysObj *_sysobj_svc);
-  int init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, bool setup_obj = true, bool old_format = false);
-  virtual int read_default_id(std::string& default_id, bool old_format = false);
-  virtual int set_as_default(bool exclusive = false);
+  int init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc,
+          optional_yield y,
+          bool setup_obj = true, bool old_format = false);
+  virtual int read_default_id(std::string& default_id, optional_yield y,
+                             bool old_format = false);
+  virtual int set_as_default(optional_yield y, bool exclusive = false);
   int delete_default();
-  virtual int create(bool exclusive = true);
-  int delete_obj(bool old_format = false);
-  int rename(const std::string& new_name);
-  int update() { return store_info(false);}
-  int update_name() { return store_name(false);}
-  int read();
-  int write(bool exclusive);
+  virtual int create(optional_yield y, bool exclusive = true);
+  int delete_obj(optional_yield y, bool old_format = false);
+  int rename(const std::string& new_name, optional_yield y);
+  int update(optional_yield y) { return store_info(false, y);}
+  int update_name(optional_yield y) { return store_name(false, y);}
+  int read(optional_yield y);
+  int write(bool exclusive, optional_yield y);
 
   virtual rgw_pool get_pool(CephContext *cct) const = 0;
   virtual const std::string get_default_oid(bool old_format = false) const = 0;
@@ -396,14 +400,14 @@ struct RGWZoneParams : RGWSystemMetaObj {
   const std::string& get_info_oid_prefix(bool old_format = false) const override;
   const std::string& get_predefined_name(CephContext *cct) const override;
 
-  int init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, bool setup_obj = true,
-          bool old_format = false);
+  int init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, optional_yield y,
+          bool setup_obj = true, bool old_format = false);
   using RGWSystemMetaObj::init;
-  int read_default_id(std::string& default_id, bool old_format = false) override;
-  int set_as_default(bool exclusive = false) override;
-  int create_default(bool old_format = false);
-  int create(bool exclusive = true) override;
-  int fix_pool_names();
+  int read_default_id(std::string& default_id, optional_yield y, bool old_format = false) override;
+  int set_as_default(optional_yield y, bool exclusive = false) override;
+  int create_default(optional_yield y, bool old_format = false);
+  int create(optional_yield y, bool exclusive = true) override;
+  int fix_pool_names(optional_yield y);
 
   const string& get_compression_type(const rgw_placement_rule& placement_rule) const;
   
@@ -756,11 +760,11 @@ struct RGWZoneGroup : public RGWSystemMetaObj {
       realm_id(_realm_id) {}
 
   bool is_master_zonegroup() const { return is_master;}
-  void update_master(bool _is_master) {
+  void update_master(bool _is_master, optional_yield y) {
     is_master = _is_master;
-    post_process_params();
+    post_process_params(y);
   }
-  void post_process_params();
+  void post_process_params(optional_yield y);
 
   void encode(bufferlist& bl) const override {
     ENCODE_START(5, 1, bl);
@@ -808,17 +812,18 @@ struct RGWZoneGroup : public RGWSystemMetaObj {
     DECODE_FINISH(bl);
   }
 
-  int read_default_id(std::string& default_id, bool old_format = false) override;
-  int set_as_default(bool exclusive = false) override;
-  int create_default(bool old_format = false);
+  int read_default_id(std::string& default_id, optional_yield y, bool old_format = false) override;
+  int set_as_default(optional_yield y, bool exclusive = false) override;
+  int create_default(optional_yield y, bool old_format = false);
   int equals(const std::string& other_zonegroup) const;
   int add_zone(const RGWZoneParams& zone_params, bool *is_master, bool *read_only,
                const list<std::string>& endpoints, const std::string *ptier_type,
                bool *psync_from_all, list<std::string>& sync_from,
                list<std::string>& sync_from_rm, std::string *predirect_zone,
-               std::optional<int> bucket_index_max_shards, RGWSyncModulesManager *sync_mgr);
-  int remove_zone(const std::string& zone_id);
-  int rename_zone(const RGWZoneParams& zone_params);
+               std::optional<int> bucket_index_max_shards, RGWSyncModulesManager *sync_mgr,
+              optional_yield y);
+  int remove_zone(const std::string& zone_id, optional_yield y);
+  int rename_zone(const RGWZoneParams& zone_params, optional_yield y);
   rgw_pool get_pool(CephContext *cct) const override;
   const std::string get_default_oid(bool old_region_format = false) const override;
   const std::string& get_info_oid_prefix(bool old_region_format = false) const override;
@@ -883,8 +888,8 @@ struct RGWPeriodConfig
   // the period config must be stored in a local object outside of the period,
   // so that it can be used in a default configuration where no realm/period
   // exists
-  int read(RGWSI_SysObj *sysobj_svc, const std::string& realm_id);
-  int write(RGWSI_SysObj *sysobj_svc, const std::string& realm_id);
+  int read(RGWSI_SysObj *sysobj_svc, const std::string& realm_id, optional_yield y);
+  int write(RGWSI_SysObj *sysobj_svc, const std::string& realm_id, optional_yield y);
 
   static std::string get_oid(const std::string& realm_id);
   static rgw_pool get_pool(CephContext *cct);
@@ -920,7 +925,7 @@ struct RGWZoneGroupMap {
   RGWQuotaInfo user_quota;
 
   /* construct the map */
-  int read(CephContext *cct, RGWSI_SysObj *sysobj_svc);
+  int read(CephContext *cct, RGWSI_SysObj *sysobj_svc, optional_yield y);
 
   void encode(bufferlist& bl) const;
   void decode(bufferlist::const_iterator& bl);
@@ -938,8 +943,8 @@ class RGWRealm : public RGWSystemMetaObj
   std::string current_period;
   epoch_t epoch{0}; //< realm epoch, incremented for each new period
 
-  int create_control(bool exclusive);
-  int delete_control();
+  int create_control(bool exclusive, optional_yield y);
+  int delete_control(optional_yield y);
 public:
   RGWRealm() {}
   RGWRealm(const std::string& _id, const std::string& _name = "") : RGWSystemMetaObj(_id, _name) {}
@@ -962,8 +967,8 @@ public:
     DECODE_FINISH(bl);
   }
 
-  int create(bool exclusive = true) override;
-  int delete_obj();
+  int create(optional_yield y, bool exclusive = true) override;
+  int delete_obj(optional_yield y);
   rgw_pool get_pool(CephContext *cct) const override;
   const std::string get_default_oid(bool old_format = false) const override;
   const std::string& get_names_oid_prefix() const override;
@@ -979,7 +984,7 @@ public:
   const std::string& get_current_period() const {
     return current_period;
   }
-  int set_current_period(RGWPeriod& period);
+  int set_current_period(RGWPeriod& period, optional_yield y);
   void clear_current_period_and_epoch() {
     current_period.clear();
     epoch = 0;
@@ -988,9 +993,9 @@ public:
 
   std::string get_control_oid() const;
   /// send a notify on the realm control object
-  int notify_zone(bufferlist& bl);
+  int notify_zone(bufferlist& bl, optional_yield y);
   /// notify the zone of a new period
-  int notify_new_period(const RGWPeriod& period);
+  int notify_new_period(const RGWPeriod& period, optional_yield y);
 };
 WRITE_CLASS_ENCODER(RGWRealm)
 
@@ -1054,10 +1059,11 @@ class RGWPeriod
   CephContext *cct{nullptr};
   RGWSI_SysObj *sysobj_svc{nullptr};
 
-  int read_info();
+  int read_info(optional_yield y);
   int read_latest_epoch(RGWPeriodLatestEpochInfo& epoch_info,
+                       optional_yield y,
                         RGWObjVersionTracker *objv = nullptr);
-  int use_latest_epoch();
+  int use_latest_epoch(optional_yield y);
   int use_current_period();
 
   const std::string get_period_oid() const;
@@ -1113,7 +1119,7 @@ public:
     realm_id = _realm_id;
   }
 
-  int reflect();
+  int reflect(optional_yield y);
 
   int get_zonegroup(RGWZoneGroup& zonegroup,
                    const std::string& zonegroup_id) const;
@@ -1139,28 +1145,30 @@ public:
     return false;
   }
 
-  int get_latest_epoch(epoch_t& epoch);
-  int set_latest_epoch(epoch_t epoch, bool exclusive = false,
+  int get_latest_epoch(epoch_t& epoch, optional_yield y);
+  int set_latest_epoch(optional_yield y,
+                      epoch_t epoch, bool exclusive = false,
                        RGWObjVersionTracker *objv = nullptr);
   // update latest_epoch if the given epoch is higher, else return -EEXIST
-  int update_latest_epoch(epoch_t epoch);
+  int update_latest_epoch(epoch_t epoch, optional_yield y);
 
-  int init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, const std::string &period_realm_id, const std::string &period_realm_name = "",
-          bool setup_obj = true);
-  int init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, bool setup_obj = true);  
+  int init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, const std::string &period_realm_id, optional_yield y,
+          const std::string &period_realm_name = "", bool setup_obj = true);
+  int init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, optional_yield y, bool setup_obj = true);  
 
-  int create(bool exclusive = true);
-  int delete_obj();
-  int store_info(bool exclusive);
-  int add_zonegroup(const RGWZoneGroup& zonegroup);
+  int create(optional_yield y, bool exclusive = true);
+  int delete_obj(optional_yield y);
+  int store_info(bool exclusive, optional_yield y);
+  int add_zonegroup(const RGWZoneGroup& zonegroup, optional_yield y);
 
   void fork();
-  int update();
+  int update(optional_yield y);
 
   // commit a staging period; only for use on master zone
   int commit(rgw::sal::RGWRadosStore *store,
              RGWRealm& realm, const RGWPeriod &current_period,
-             std::ostream& error_stream, bool force_if_stale = false);
+             std::ostream& error_stream, optional_yield y,
+            bool force_if_stale = false);
 
   void encode(bufferlist& bl) const {
     ENCODE_START(1, 1, bl);
index 9e76258a692332a70111d90451798f25107a5d7c..8e26c12cebf5960ce9f5eb9708cbb1775d53eeb2 100644 (file)
@@ -243,7 +243,7 @@ class TrimHistoryCR : public RGWCoroutine {
 
 // traverse all the way back to the beginning of the period history, and
 // return a cursor to the first period in a fully attached history
-Cursor RGWSI_MDLog::find_oldest_period()
+Cursor RGWSI_MDLog::find_oldest_period(optional_yield y)
 {
   auto cursor = period_history->get_current();
 
@@ -259,7 +259,7 @@ Cursor RGWSI_MDLog::find_oldest_period()
       }
       // pull the predecessor and add it to our history
       RGWPeriod period;
-      int r = period_puller->pull(predecessor, period);
+      int r = period_puller->pull(predecessor, period, y);
       if (r < 0) {
         return cursor;
       }
@@ -287,7 +287,7 @@ Cursor RGWSI_MDLog::init_oldest_log_period(optional_yield y)
   if (ret == -ENOENT) {
     // initialize the mdlog history and write it
     ldout(cct, 10) << "initializing mdlog history" << dendl;
-    auto cursor = find_oldest_period();
+    auto cursor = find_oldest_period(y);
     if (!cursor) {
       return cursor;
     }
@@ -314,7 +314,7 @@ Cursor RGWSI_MDLog::init_oldest_log_period(optional_yield y)
   if (cursor) {
     return cursor;
   } else {
-    cursor = find_oldest_period();
+    cursor = find_oldest_period(y);
     state.oldest_realm_epoch = cursor.get_epoch();
     state.oldest_period_id = cursor.get_period().get_id();
     ldout(cct, 10) << "rewriting mdlog history" << dendl;
@@ -329,7 +329,7 @@ Cursor RGWSI_MDLog::init_oldest_log_period(optional_yield y)
 
   // pull the oldest period by id
   RGWPeriod period;
-  ret = period_puller->pull(state.oldest_period_id, period);
+  ret = period_puller->pull(state.oldest_period_id, period, y);
   if (ret < 0) {
     ldout(cct, 1) << "failed to read period id=" << state.oldest_period_id
         << " for mdlog history: " << cpp_strerror(ret) << dendl;
@@ -343,7 +343,7 @@ Cursor RGWSI_MDLog::init_oldest_log_period(optional_yield y)
     return Cursor{-EINVAL};
   }
   // attach the period to our history
-  return period_history->attach(std::move(period));
+  return period_history->attach(std::move(period), y);
 }
 
 Cursor RGWSI_MDLog::read_oldest_log_period(optional_yield y) const
@@ -396,8 +396,9 @@ int RGWSI_MDLog::get_shard_id(const string& hash_key, int *shard_id)
   return current_log->get_shard_id(hash_key, shard_id);
 }
 
-int RGWSI_MDLog::pull_period(const std::string& period_id, RGWPeriod& period)
+int RGWSI_MDLog::pull_period(const std::string& period_id, RGWPeriod& period,
+                            optional_yield y)
 {
-  return period_puller->pull(period_id, period);
+  return period_puller->pull(period_id, period, y);
 }
 
index d8dec86bf82331caf3391c21e363d8db621ccdb1..d578664ab9bc03741172eb6983185f493b767b89 100644 (file)
@@ -75,7 +75,7 @@ public:
 
   // traverse all the way back to the beginning of the period history, and
   // return a cursor to the first period in a fully attached history
-  RGWPeriodHistory::Cursor find_oldest_period();
+  RGWPeriodHistory::Cursor find_oldest_period(optional_yield y);
 
   /// initialize the oldest log period if it doesn't exist, and attach it to
   /// our current history
@@ -107,7 +107,7 @@ public:
     return period_history.get();
   }
 
-  int pull_period(const std::string& period_id, RGWPeriod& period);
+  int pull_period(const std::string& period_id, RGWPeriod& period, optional_yield y);
 
   /// find or create the metadata log for the given period
   RGWMetadataLog* get_log(const std::string& period);
index 4c06121f36a7ec0d35cecd935f96d3d8977af46b..1e67fe89da6676ae664f899eb006c59b6c472ac6 100644 (file)
@@ -78,13 +78,14 @@ int RGWSI_Zone::do_start(optional_yield y)
     return ret;
   }
 
-  ret = realm->init(cct, sysobj_svc);
+  ret = realm->init(cct, sysobj_svc, y);
   if (ret < 0 && ret != -ENOENT) {
     ldout(cct, 0) << "failed reading realm info: ret "<< ret << " " << cpp_strerror(-ret) << dendl;
     return ret;
   } else if (ret != -ENOENT) {
     ldout(cct, 20) << "realm  " << realm->get_name() << " " << realm->get_id() << dendl;
-    ret = current_period->init(cct, sysobj_svc, realm->get_id(), realm->get_name());
+    ret = current_period->init(cct, sysobj_svc, realm->get_id(), y,
+                              realm->get_name());
     if (ret < 0 && ret != -ENOENT) {
       ldout(cct, 0) << "failed reading current period info: " << " " << cpp_strerror(-ret) << dendl;
       return ret;
@@ -107,7 +108,7 @@ int RGWSI_Zone::do_start(optional_yield y)
   bool zg_initialized = false;
 
   if (!current_period->get_id().empty()) {
-    ret = init_zg_from_period(&zg_initialized);
+    ret = init_zg_from_period(&zg_initialized, y);
     if (ret < 0) {
       return ret;
     }
@@ -117,13 +118,13 @@ int RGWSI_Zone::do_start(optional_yield y)
   bool using_local = (!zg_initialized);
   if (using_local) {
     ldout(cct, 10) << " cannot find current period zonegroup using local zonegroup" << dendl;
-    ret = init_zg_from_local(&creating_defaults);
+    ret = init_zg_from_local(&creating_defaults, y);
     if (ret < 0) {
       return ret;
     }
     // read period_config into current_period
     auto& period_config = current_period->get_config();
-    ret = period_config.read(sysobj_svc, zonegroup->realm_id);
+    ret = period_config.read(sysobj_svc, zonegroup->realm_id, y);
     if (ret < 0 && ret != -ENOENT) {
       ldout(cct, 0) << "ERROR: failed to read period config: "
           << cpp_strerror(ret) << dendl;
@@ -137,7 +138,7 @@ int RGWSI_Zone::do_start(optional_yield y)
     zone_params->set_name(default_zone_name);
   }
 
-  ret = zone_params->init(cct, sysobj_svc);
+  ret = zone_params->init(cct, sysobj_svc, y);
   if (ret < 0 && ret != -ENOENT) {
     lderr(cct) << "failed reading zone info: ret "<< ret << " " << cpp_strerror(-ret) << dendl;
     return ret;
@@ -152,7 +153,7 @@ int RGWSI_Zone::do_start(optional_yield y)
       return -EINVAL;
     }
     ldout(cct, 1) << "Cannot find zone id=" << zone_params->get_id() << " (name=" << zone_params->get_name() << "), switching to local zonegroup configuration" << dendl;
-    ret = init_zg_from_local(&creating_defaults);
+    ret = init_zg_from_local(&creating_defaults, y);
     if (ret < 0) {
       return ret;
     }
@@ -321,20 +322,20 @@ int RGWSI_Zone::list_periods(list<string>& periods)
 }
 
 
-int RGWSI_Zone::list_periods(const string& current_period, list<string>& periods)
+int RGWSI_Zone::list_periods(const string& current_period, list<string>& periods, optional_yield y)
 {
   int ret = 0;
   string period_id = current_period;
   while(!period_id.empty()) {
     RGWPeriod period(period_id);
-    ret = period.init(cct, sysobj_svc);
+    ret = period.init(cct, sysobj_svc, y);
     if (ret < 0) {
       return ret;
     }
     periods.push_back(period.get_id());
     period_id = period.get_predecessor();
   }
-  
+
   return ret;
 }
 
@@ -371,12 +372,12 @@ int RGWSI_Zone::replace_region_with_zonegroup(optional_yield y)
   }
 
   string default_region;
-  ret = default_zonegroup.init(cct, sysobj_svc, false, true);
+  ret = default_zonegroup.init(cct, sysobj_svc, y, false, true);
   if (ret < 0) {
     ldout(cct, 0) <<  __func__ << " failed init default region: ret "<< ret << " " << cpp_strerror(-ret) << dendl;
     return ret;
-  }    
-  ret  = default_zonegroup.read_default_id(default_region, true);
+  }
+  ret  = default_zonegroup.read_default_id(default_region, y, true);
   if (ret < 0 && ret != -ENOENT) {
     ldout(cct, 0) <<  __func__ << " failed reading old default region: ret "<< ret << " " << cpp_strerror(-ret) << dendl;
     return ret;
@@ -390,21 +391,21 @@ int RGWSI_Zone::replace_region_with_zonegroup(optional_yield y)
     return ret;
   } else if (ret == -ENOENT || regions.empty()) {
     RGWZoneParams zoneparams(default_zone_name);
-    int ret = zoneparams.init(cct, sysobj_svc);
+    int ret = zoneparams.init(cct, sysobj_svc, y);
     if (ret < 0 && ret != -ENOENT) {
       ldout(cct, 0) << __func__ << ": error initializing default zone params: " << cpp_strerror(-ret) << dendl;
       return ret;
     }
     /* update master zone */
     RGWZoneGroup default_zg(default_zonegroup_name);
-    ret = default_zg.init(cct, sysobj_svc);
+    ret = default_zg.init(cct, sysobj_svc, y);
     if (ret < 0 && ret != -ENOENT) {
       ldout(cct, 0) << __func__ << ": error in initializing default zonegroup: " << cpp_strerror(-ret) << dendl;
       return ret;
     }
     if (ret != -ENOENT && default_zg.master_zone.empty()) {
       default_zg.master_zone = zoneparams.get_id();
-      return default_zg.update();
+      return default_zg.update(y);
     }
     return 0;
   }
@@ -414,7 +415,7 @@ int RGWSI_Zone::replace_region_with_zonegroup(optional_yield y)
   for (list<string>::iterator iter = regions.begin(); iter != regions.end(); ++iter) {
     if (*iter != default_zonegroup_name){
       RGWZoneGroup region(*iter);
-      int ret = region.init(cct, sysobj_svc, true, true);
+      int ret = region.init(cct, sysobj_svc, y, true, true);
       if (ret < 0) {
          ldout(cct, 0) <<  __func__ << " failed init region "<< *iter << ": " << cpp_strerror(-ret) << dendl;
          return ret;
@@ -439,27 +440,28 @@ int RGWSI_Zone::replace_region_with_zonegroup(optional_yield y)
     buf_to_hex(md5, CEPH_CRYPTO_MD5_DIGESTSIZE, md5_str);
     string new_realm_id(md5_str);
     RGWRealm new_realm(new_realm_id,new_realm_name);
-    ret = new_realm.init(cct, sysobj_svc, false);
+    ret = new_realm.init(cct, sysobj_svc, y, false);
     if (ret < 0) {
       ldout(cct, 0) <<  __func__ << " Error initing new realm: " << cpp_strerror(-ret)  << dendl;
       return ret;
     }
-    ret = new_realm.create();
+    ret = new_realm.create(y);
     if (ret < 0 && ret != -EEXIST) {
       ldout(cct, 0) <<  __func__ << " Error creating new realm: " << cpp_strerror(-ret)  << dendl;
       return ret;
     }
-    ret = new_realm.set_as_default();
+    ret = new_realm.set_as_default(y);
     if (ret < 0) {
       ldout(cct, 0) << __func__ << " Error setting realm as default: " << cpp_strerror(-ret)  << dendl;
       return ret;
     }
-    ret = realm->init(cct, sysobj_svc);
+    ret = realm->init(cct, sysobj_svc, y);
     if (ret < 0) {
       ldout(cct, 0) << __func__ << " Error initing realm: " << cpp_strerror(-ret)  << dendl;
       return ret;
     }
-    ret = current_period->init(cct, sysobj_svc, realm->get_id(), realm->get_name());
+    ret = current_period->init(cct, sysobj_svc, realm->get_id(), y,
+                              realm->get_name());
     if (ret < 0) {
       ldout(cct, 0) << __func__ << " Error initing current period: " << cpp_strerror(-ret)  << dendl;
       return ret;
@@ -473,7 +475,7 @@ int RGWSI_Zone::replace_region_with_zonegroup(optional_yield y)
     ldout(cct, 0) << __func__ << " Converting  " << *iter << dendl;
     /* check to see if we don't have already a zonegroup with this name */
     RGWZoneGroup new_zonegroup(*iter);
-    ret = new_zonegroup.init(cct , sysobj_svc);
+    ret = new_zonegroup.init(cct , sysobj_svc, y);
     if (ret == 0 && new_zonegroup.get_id() != *iter) {
       ldout(cct, 0) << __func__ << " zonegroup  "<< *iter << " already exists id " << new_zonegroup.get_id () <<
        " skipping conversion " << dendl;
@@ -481,7 +483,7 @@ int RGWSI_Zone::replace_region_with_zonegroup(optional_yield y)
     }
     RGWZoneGroup zonegroup(*iter);
     zonegroup.set_id(*iter);
-    int ret = zonegroup.init(cct, sysobj_svc, true, true);
+    int ret = zonegroup.init(cct, sysobj_svc, y, true, true);
     if (ret < 0) {
       ldout(cct, 0) << __func__ << " failed init zonegroup: ret "<< ret << " " << cpp_strerror(-ret) << dendl;
       return ret;
@@ -492,20 +494,20 @@ int RGWSI_Zone::replace_region_with_zonegroup(optional_yield y)
       ldout(cct, 0) << __func__ << " Setting default zone as master for default region" << dendl;
       zonegroup.master_zone = default_zone_name;
     }
-    ret = zonegroup.update();
+    ret = zonegroup.update(y);
     if (ret < 0 && ret != -EEXIST) {
       ldout(cct, 0) << __func__ << " failed to update zonegroup " << *iter << ": ret "<< ret << " " << cpp_strerror(-ret)
         << dendl;
       return ret;
     }
-    ret = zonegroup.update_name();
+    ret = zonegroup.update_name(y);
     if (ret < 0 && ret != -EEXIST) {
       ldout(cct, 0) << __func__ << " failed to update_name for zonegroup " << *iter << ": ret "<< ret << " " << cpp_strerror(-ret)
         << dendl;
       return ret;
     }
     if (zonegroup.get_name() == default_region) {
-      ret = zonegroup.set_as_default();
+      ret = zonegroup.set_as_default(y);
       if (ret < 0) {
         ldout(cct, 0) << __func__ << " failed to set_as_default " << *iter << ": ret "<< ret << " " << cpp_strerror(-ret)
           << dendl;
@@ -518,7 +520,7 @@ int RGWSI_Zone::replace_region_with_zonegroup(optional_yield y)
       RGWZoneParams zoneparams(iter->first, iter->second.name);
       zoneparams.set_id(iter->first.id);
       zoneparams.realm_id = realm->get_id();
-      ret = zoneparams.init(cct, sysobj_svc);
+      ret = zoneparams.init(cct, sysobj_svc, y);
       if (ret < 0 && ret != -ENOENT) {
         ldout(cct, 0) << __func__ << " failed to init zoneparams  " << iter->first <<  ": " << cpp_strerror(-ret) << dendl;
         return ret;
@@ -527,12 +529,12 @@ int RGWSI_Zone::replace_region_with_zonegroup(optional_yield y)
         continue;
       }
       zonegroup.realm_id = realm->get_id();
-      ret = zoneparams.update();
+      ret = zoneparams.update(y);
       if (ret < 0 && ret != -EEXIST) {
         ldout(cct, 0) << __func__ << " failed to update zoneparams " << iter->first <<  ": " << cpp_strerror(-ret) << dendl;
         return ret;
       }
-      ret = zoneparams.update_name();
+      ret = zoneparams.update_name(y);
       if (ret < 0 && ret != -EEXIST) {
         ldout(cct, 0) << __func__ << " failed to init zoneparams " << iter->first <<  ": " << cpp_strerror(-ret) << dendl;
         return ret;
@@ -540,7 +542,7 @@ int RGWSI_Zone::replace_region_with_zonegroup(optional_yield y)
     }
 
     if (!current_period->get_id().empty()) {
-      ret = current_period->add_zonegroup(zonegroup);
+      ret = current_period->add_zonegroup(zonegroup, y);
       if (ret < 0) {
         ldout(cct, 0) << __func__ << " failed to add zonegroup to current_period: " << cpp_strerror(-ret) << dendl;
         return ret;
@@ -549,17 +551,17 @@ int RGWSI_Zone::replace_region_with_zonegroup(optional_yield y)
   }
 
   if (!current_period->get_id().empty()) {
-    ret = current_period->update();
+    ret = current_period->update(y);
     if (ret < 0) {
       ldout(cct, 0) << __func__ << " failed to update new period: " << cpp_strerror(-ret) << dendl;
       return ret;
     }
-    ret = current_period->store_info(false);
+    ret = current_period->store_info(false, y);
     if (ret < 0) {
       ldout(cct, 0) << __func__ << " failed to store new period: " << cpp_strerror(-ret) << dendl;
       return ret;
     }
-    ret = current_period->reflect();
+    ret = current_period->reflect(y);
     if (ret < 0) {
       ldout(cct, 0) << __func__ << " failed to update local objects: " << cpp_strerror(-ret) << dendl;
       return ret;
@@ -568,12 +570,12 @@ int RGWSI_Zone::replace_region_with_zonegroup(optional_yield y)
 
   for (auto const& iter : regions) {
     RGWZoneGroup zonegroup(iter);
-    int ret = zonegroup.init(cct, sysobj_svc, true, true);
+    int ret = zonegroup.init(cct, sysobj_svc, y, true, true);
     if (ret < 0) {
       ldout(cct, 0) << __func__ << " failed init zonegroup" << iter << ": ret "<< ret << " " << cpp_strerror(-ret) << dendl;
       return ret;
     }
-    ret = zonegroup.delete_obj(true);
+    ret = zonegroup.delete_obj(y, true);
     if (ret < 0 && ret != -ENOENT) {
       ldout(cct, 0) << __func__ << " failed to delete region " << iter << ": ret "<< ret << " " << cpp_strerror(-ret)
         << dendl;
@@ -608,12 +610,12 @@ static void add_new_connection_to_map(map<string, RGWRESTConn *> &zonegroup_conn
   if (iterZoneGroup != zonegroup_conn_map.end()) {
     delete iterZoneGroup->second;
   }
-    
+
   // Add new connection to connections map
   zonegroup_conn_map[zonegroup.get_id()] = new_connection;
 }
 
-int RGWSI_Zone::init_zg_from_period(bool *initialized)
+int RGWSI_Zone::init_zg_from_period(bool *initialized, optional_yield y)
 {
   *initialized = false;
 
@@ -621,7 +623,7 @@ int RGWSI_Zone::init_zg_from_period(bool *initialized)
     return 0;
   }
 
-  int ret = zonegroup->init(cct, sysobj_svc);
+  int ret = zonegroup->init(cct, sysobj_svc, y);
   ldout(cct, 20) << "period zonegroup init ret " << ret << dendl;
   if (ret == -ENOENT) {
     return 0;
@@ -638,19 +640,19 @@ int RGWSI_Zone::init_zg_from_period(bool *initialized)
   if (iter != current_period->get_map().zonegroups.end()) {
     ldout(cct, 20) << "using current period zonegroup " << zonegroup->get_name() << dendl;
     *zonegroup = iter->second;
-    ret = zonegroup->init(cct, sysobj_svc, false);
+    ret = zonegroup->init(cct, sysobj_svc, y, false);
     if (ret < 0) {
       ldout(cct, 0) << "failed init zonegroup: " << " " << cpp_strerror(-ret) << dendl;
       return ret;
     }
-    ret = zone_params->init(cct, sysobj_svc);
+    ret = zone_params->init(cct, sysobj_svc, y);
     if (ret < 0 && ret != -ENOENT) {
       ldout(cct, 0) << "failed reading zone params info: " << " " << cpp_strerror(-ret) << dendl;
       return ret;
     } if (ret ==-ENOENT && zonegroup->get_name() == default_zonegroup_name) {
       ldout(cct, 10) << " Using default name "<< default_zone_name << dendl;
       zone_params->set_name(default_zone_name);
-      ret = zone_params->init(cct, sysobj_svc);
+      ret = zone_params->init(cct, sysobj_svc, y);
       if (ret < 0 && ret != -ENOENT) {
        ldout(cct, 0) << "failed reading zone params info: " << " " << cpp_strerror(-ret) << dendl;
        return ret;
@@ -673,20 +675,20 @@ int RGWSI_Zone::init_zg_from_period(bool *initialized)
          master->second.name << " id:" << master->second.id << " as master" << dendl;
        if (zonegroup->get_id() == zg.get_id()) {
          zonegroup->master_zone = master->second.id;
-         ret = zonegroup->update();
+         ret = zonegroup->update(y);
          if (ret < 0) {
            ldout(cct, 0) << "error updating zonegroup : " << cpp_strerror(-ret) << dendl;
            return ret;
          }
        } else {
          RGWZoneGroup fixed_zg(zg.get_id(),zg.get_name());
-         ret = fixed_zg.init(cct, sysobj_svc);
+         ret = fixed_zg.init(cct, sysobj_svc, y);
          if (ret < 0) {
            ldout(cct, 0) << "error initializing zonegroup : " << cpp_strerror(-ret) << dendl;
            return ret;
          }
          fixed_zg.master_zone = master->second.id;
-         ret = fixed_zg.update();
+         ret = fixed_zg.update(y);
          if (ret < 0) {
            ldout(cct, 0) << "error initializing zonegroup : " << cpp_strerror(-ret) << dendl;
            return ret;
@@ -711,22 +713,22 @@ int RGWSI_Zone::init_zg_from_period(bool *initialized)
   return 0;
 }
 
-int RGWSI_Zone::init_zg_from_local(bool *creating_defaults)
+int RGWSI_Zone::init_zg_from_local(bool *creating_defaults, optional_yield y)
 {
-  int ret = zonegroup->init(cct, sysobj_svc);
+  int ret = zonegroup->init(cct, sysobj_svc, y);
   if ( (ret < 0 && ret != -ENOENT) || (ret == -ENOENT && !cct->_conf->rgw_zonegroup.empty())) {
     ldout(cct, 0) << "failed reading zonegroup info: ret "<< ret << " " << cpp_strerror(-ret) << dendl;
     return ret;
   } else if (ret == -ENOENT) {
     *creating_defaults = true;
     ldout(cct, 10) << "Creating default zonegroup " << dendl;
-    ret = zonegroup->create_default();
+    ret = zonegroup->create_default(y);
     if (ret < 0) {
       ldout(cct, 0) << "failure in zonegroup create_default: ret "<< ret << " " << cpp_strerror(-ret)
         << dendl;
       return ret;
     }
-    ret = zonegroup->init(cct, sysobj_svc);
+    ret = zonegroup->init(cct, sysobj_svc, y);
     if (ret < 0) {
       ldout(cct, 0) << "failure in zonegroup create_default: ret "<< ret << " " << cpp_strerror(-ret)
         << dendl;
@@ -744,7 +746,7 @@ int RGWSI_Zone::init_zg_from_local(bool *creating_defaults)
        ldout(cct, 0) << "zonegroup " << zonegroup->get_name() << " missing master_zone, setting zone " <<
          master->second.name << " id:" << master->second.id << " as master" << dendl;
        zonegroup->master_zone = master->second.id;
-       ret = zonegroup->update();
+       ret = zonegroup->update(y);
        if (ret < 0) {
          ldout(cct, 0) << "error initializing zonegroup : " << cpp_strerror(-ret) << dendl;
          return ret;
@@ -796,14 +798,14 @@ int RGWSI_Zone::convert_regionmap(optional_yield y)
   for (map<string, RGWZoneGroup>::iterator iter = zonegroupmap.zonegroups.begin();
        iter != zonegroupmap.zonegroups.end(); ++iter) {
     RGWZoneGroup& zonegroup = iter->second;
-    ret = zonegroup.init(cct, sysobj_svc, false);
-    ret = zonegroup.update();
+    ret = zonegroup.init(cct, sysobj_svc, y, false);
+    ret = zonegroup.update(y);
     if (ret < 0 && ret != -ENOENT) {
       ldout(cct, 0) << "Error could not update zonegroup " << zonegroup.get_name() << ": " <<
        cpp_strerror(-ret) << dendl;
       return ret;
     } else if (ret == -ENOENT) {
-      ret = zonegroup.create();
+      ret = zonegroup.create(y);
       if (ret < 0) {
        ldout(cct, 0) << "Error could not create " << zonegroup.get_name() << ": " <<
          cpp_strerror(-ret) << dendl;
index 0ad5a290a9b657e5c4e740a0f306126ff0c1feeb..539d56d57e06a567f9a79a4e359a696a78b5cfab 100644 (file)
@@ -65,8 +65,8 @@ class RGWSI_Zone : public RGWServiceInstance
   void shutdown() override;
 
   int replace_region_with_zonegroup(optional_yield y);
-  int init_zg_from_period(bool *initialized);
-  int init_zg_from_local(bool *creating_defaults);
+  int init_zg_from_period(bool *initialized, optional_yield y);
+  int init_zg_from_local(bool *creating_defaults, optional_yield y);
   int convert_regionmap(optional_yield y);
 
   int update_placement_map(optional_yield y);
@@ -151,5 +151,5 @@ public:
   int list_zones(list<string>& zones);
   int list_realms(list<string>& realms);
   int list_periods(list<string>& periods);
-  int list_periods(const string& current_period, list<string>& periods);
+  int list_periods(const string& current_period, list<string>& periods, optional_yield y);
 };
index 27ea062949356ea820aa3835d79d90b04c250ccb..2bac99b0bb9221eda941a63617b2c4101f22d447 100644 (file)
@@ -35,7 +35,7 @@ const auto current_period = make_period("5", 5, "4");
 
 // mock puller that throws an exception if it's called
 struct ErrorPuller : public RGWPeriodHistory::Puller {
-  int pull(const std::string& id, RGWPeriod& period) override {
+  int pull(const std::string& id, RGWPeriod& period, optional_yield) override {
     throw std::runtime_error("unexpected call to pull");
   }
 };
@@ -48,7 +48,7 @@ class RecordingPuller : public RGWPeriodHistory::Puller {
  public:
   explicit RecordingPuller(int error) : error(error) {}
   Ids ids;
-  int pull(const std::string& id, RGWPeriod& period) override {
+  int pull(const std::string& id, RGWPeriod& period, optional_yield) override {
     ids.push_back(id);
     return error;
   }
@@ -56,7 +56,7 @@ class RecordingPuller : public RGWPeriodHistory::Puller {
 
 // mock puller that returns a fake period by parsing the period id
 struct NumericPuller : public RGWPeriodHistory::Puller {
-  int pull(const std::string& id, RGWPeriod& period) override {
+  int pull(const std::string& id, RGWPeriod& period, optional_yield) override {
     // relies on numeric period ids to divine the realm_epoch
     auto realm_epoch = boost::lexical_cast<epoch_t>(id);
     auto predecessor = boost::lexical_cast<std::string>(realm_epoch-1);
@@ -133,7 +133,7 @@ TEST(PeriodHistory, PullPredecessorsBeforeCurrent)
 
   // create a disjoint history at 1 and verify that periods are requested
   // backwards from current_period
-  auto c1 = history.attach(make_period("1", 1, ""));
+  auto c1 = history.attach(make_period("1", 1, ""), null_yield);
   ASSERT_FALSE(c1);
   ASSERT_EQ(-EFAULT, c1.get_error());
   ASSERT_EQ(Ids{"4"}, puller.ids);
@@ -141,7 +141,7 @@ TEST(PeriodHistory, PullPredecessorsBeforeCurrent)
   auto c4 = history.insert(make_period("4", 4, "3"));
   ASSERT_TRUE(c4);
 
-  c1 = history.attach(make_period("1", 1, ""));
+  c1 = history.attach(make_period("1", 1, ""), null_yield);
   ASSERT_FALSE(c1);
   ASSERT_EQ(-EFAULT, c1.get_error());
   ASSERT_EQ(Ids({"4", "3"}), puller.ids);
@@ -149,7 +149,7 @@ TEST(PeriodHistory, PullPredecessorsBeforeCurrent)
   auto c3 = history.insert(make_period("3", 3, "2"));
   ASSERT_TRUE(c3);
 
-  c1 = history.attach(make_period("1", 1, ""));
+  c1 = history.attach(make_period("1", 1, ""), null_yield);
   ASSERT_FALSE(c1);
   ASSERT_EQ(-EFAULT, c1.get_error());
   ASSERT_EQ(Ids({"4", "3", "2"}), puller.ids);
@@ -157,7 +157,7 @@ TEST(PeriodHistory, PullPredecessorsBeforeCurrent)
   auto c2 = history.insert(make_period("2", 2, "1"));
   ASSERT_TRUE(c2);
 
-  c1 = history.attach(make_period("1", 1, ""));
+  c1 = history.attach(make_period("1", 1, ""), null_yield);
   ASSERT_TRUE(c1);
   ASSERT_EQ(Ids({"4", "3", "2"}), puller.ids);
 }
@@ -169,22 +169,22 @@ TEST(PeriodHistory, PullPredecessorsAfterCurrent)
 
   // create a disjoint history at 9 and verify that periods are requested
   // backwards down to current_period
-  auto c9 = history.attach(make_period("9", 9, "8"));
+  auto c9 = history.attach(make_period("9", 9, "8"), null_yield);
   ASSERT_FALSE(c9);
   ASSERT_EQ(-EFAULT, c9.get_error());
   ASSERT_EQ(Ids{"8"}, puller.ids);
 
-  auto c8 = history.attach(make_period("8", 8, "7"));
+  auto c8 = history.attach(make_period("8", 8, "7"), null_yield);
   ASSERT_FALSE(c8);
   ASSERT_EQ(-EFAULT, c8.get_error());
   ASSERT_EQ(Ids({"8", "7"}), puller.ids);
 
-  auto c7 = history.attach(make_period("7", 7, "6"));
+  auto c7 = history.attach(make_period("7", 7, "6"), null_yield);
   ASSERT_FALSE(c7);
   ASSERT_EQ(-EFAULT, c7.get_error());
   ASSERT_EQ(Ids({"8", "7", "6"}), puller.ids);
 
-  auto c6 = history.attach(make_period("6", 6, "5"));
+  auto c6 = history.attach(make_period("6", 6, "5"), null_yield);
   ASSERT_TRUE(c6);
   ASSERT_EQ(Ids({"8", "7", "6"}), puller.ids);
 }
@@ -271,7 +271,7 @@ TEST(PeriodHistory, AttachBefore)
   NumericPuller puller;
   RGWPeriodHistory history(g_ceph_context, &puller, current_period);
 
-  auto c1 = history.attach(make_period("1", 1, ""));
+  auto c1 = history.attach(make_period("1", 1, ""), null_yield);
   ASSERT_TRUE(c1);
 
   // verify that we pulled and merged all periods from 1-5
@@ -297,7 +297,7 @@ TEST(PeriodHistory, AttachAfter)
   NumericPuller puller;
   RGWPeriodHistory history(g_ceph_context, &puller, current_period);
 
-  auto c9 = history.attach(make_period("9", 9, "8"));
+  auto c9 = history.attach(make_period("9", 9, "8"), null_yield);
   ASSERT_TRUE(c9);
 
   // verify that we pulled and merged all periods from 5-9