]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: thread yield context through writing of head obj
authorAli Maredia <amaredia@redhat.com>
Thu, 16 May 2019 22:16:47 +0000 (18:16 -0400)
committerAli Maredia <amaredia@redhat.com>
Mon, 8 Jul 2019 17:28:19 +0000 (13:28 -0400)
Signed-off-by: Ali Maredia <amaredia@redhat.com>
21 files changed:
src/rgw/rgw_admin.cc
src/rgw/rgw_bucket.cc
src/rgw/rgw_bucket.h
src/rgw/rgw_cr_rados.cc
src/rgw/rgw_file.cc
src/rgw/rgw_lc.cc
src/rgw/rgw_multi.cc
src/rgw/rgw_op.cc
src/rgw/rgw_orphan.cc
src/rgw/rgw_pubsub.cc
src/rgw/rgw_putobj_processor.cc
src/rgw/rgw_putobj_processor.h
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h
src/rgw/rgw_rest_bucket.cc
src/rgw/rgw_rest_s3.cc
src/rgw/rgw_rest_swift.cc
src/rgw/rgw_rest_user.cc
src/rgw/rgw_tools.cc
src/rgw/rgw_user.cc
src/rgw/rgw_user.h

index d7ac54d79bba722d3499cfdfc55674d015910943..96b4241aea7781786ea4f57b7bc017d9e723da13 100644 (file)
@@ -1443,7 +1443,7 @@ int check_min_obj_stripe_size(RGWRados *store, RGWBucketInfo& bucket_info, rgw_o
   read_op.params.attrs = &attrs;
   read_op.params.obj_size = &obj_size;
 
-  int ret = read_op.prepare();
+  int ret = read_op.prepare(null_yield);
   if (ret < 0) {
     lderr(store->ctx()) << "ERROR: failed to stat object, returned error: " << cpp_strerror(-ret) << dendl;
     return ret;
@@ -1505,7 +1505,7 @@ int check_obj_locator_underscore(RGWBucketInfo& bucket_info, rgw_obj& obj, rgw_o
   RGWRados::Object op_target(store, bucket_info, obj_ctx, obj);
   RGWRados::Object::Read read_op(&op_target);
 
-  int ret = read_op.prepare();
+  int ret = read_op.prepare(null_yield);
   bool needs_fixing = (ret == -ENOENT);
 
   f->dump_bool("needs_fixing", needs_fixing);
@@ -1540,7 +1540,7 @@ int check_obj_tail_locator_underscore(RGWBucketInfo& bucket_info, rgw_obj& obj,
   bool needs_fixing;
   string status;
 
-  int ret = store->fix_tail_obj_locator(bucket_info, key, fix, &needs_fixing);
+  int ret = store->fix_tail_obj_locator(bucket_info, key, fix, &needs_fixing, null_yield);
   if (ret < 0) {
     cerr << "ERROR: fix_tail_object_locator_underscore() returned ret=" << ret << std::endl;
     status = "failed";
@@ -1600,7 +1600,7 @@ int do_check_object_locator(const string& tenant_name, const string& bucket_name
 
   f->open_array_section("check_objects");
   do {
-    ret = list_op.list_objects(max_entries - count, &result, &common_prefixes, &truncated);
+    ret = list_op.list_objects(max_entries - count, &result, &common_prefixes, &truncated, null_yield);
     if (ret < 0) {
       cerr << "ERROR: store->list_objects(): " << cpp_strerror(-ret) << std::endl;
       return -ret;
@@ -5016,7 +5016,7 @@ int main(int argc, const char **argv)
     }
     break;
   case OPT_USER_RM:
-    ret = user.remove(user_op, &err_msg);
+    ret = user.remove(user_op, null_yield, &err_msg);
     if (ret < 0) {
       cerr << "could not remove user: " << err_msg << std::endl;
       return -ret;
@@ -5475,7 +5475,7 @@ int main(int argc, const char **argv)
       list_op.params.allow_unordered = bool(allow_unordered);
 
       do {
-        ret = list_op.list_objects(max_entries - count, &result, &common_prefixes, &truncated);
+        ret = list_op.list_objects(max_entries - count, &result, &common_prefixes, &truncated, null_yield);
         if (ret < 0) {
           cerr << "ERROR: store->list_objects(): " << cpp_strerror(-ret) << std::endl;
           return -ret;
@@ -5822,7 +5822,7 @@ next:
 
     RGWObjState *state;
 
-    ret = store->get_obj_state(&rctx, bucket_info, obj, &state, false); /* don't follow olh */
+    ret = store->get_obj_state(&rctx, bucket_info, obj, &state, false, null_yield); /* don't follow olh */
     if (ret < 0) {
       return -ret;
     }
@@ -6161,6 +6161,7 @@ next:
        store->cls_bucket_list_ordered(bucket_info, RGW_NO_SHARD, marker,
                                       prefix, 1000, true,
                                       result, &is_truncated, &marker,
+                                       null_yield,
                                       bucket_object_check_filter);
 
       if (r < 0 && r != -ENOENT) {
@@ -6443,7 +6444,7 @@ next:
     read_op.params.attrs = &attrs;
     read_op.params.obj_size = &obj_size;
 
-    ret = read_op.prepare();
+    ret = read_op.prepare(null_yield);
     if (ret < 0) {
       cerr << "ERROR: failed to stat object, returned error: " << cpp_strerror(-ret) << std::endl;
       return 1;
@@ -6492,20 +6493,20 @@ next:
       }
       do_check_object_locator(tenant, bucket_name, fix, remove_bad, formatter);
     } else {
-      RGWBucketAdminOp::check_index(store, bucket_op, f);
+      RGWBucketAdminOp::check_index(store, bucket_op, f, null_yield);
     }
   }
 
   if (opt_cmd == OPT_BUCKET_RM) {
     if (!inconsistent_index) {
-      RGWBucketAdminOp::remove_bucket(store, bucket_op, bypass_gc, true);
+      RGWBucketAdminOp::remove_bucket(store, bucket_op, null_yield, bypass_gc, true);
     } else {
       if (!yes_i_really_mean_it) {
        cerr << "using --inconsistent_index can corrupt the bucket index " << std::endl
        << "do you really mean it? (requires --yes-i-really-mean-it)" << std::endl;
        return 1;
       }
-      RGWBucketAdminOp::remove_bucket(store, bucket_op, bypass_gc, false);
+      RGWBucketAdminOp::remove_bucket(store, bucket_op, null_yield, bypass_gc, false);
     }
   }
 
index d1288187c5fabde4612ec599ea58401cc5907dcb..c6db07186ffc45432e4d1481e68b4b8d1ddd9b8b 100644 (file)
@@ -519,7 +519,7 @@ int rgw_remove_object(RGWRados *store, const RGWBucketInfo& bucket_info, const r
   return store->delete_obj(rctx, bucket_info, obj, bucket_info.versioning_status());
 }
 
-int rgw_remove_bucket(RGWRados *store, rgw_bucket& bucket, bool delete_children)
+int rgw_remove_bucket(RGWRados *store, rgw_bucket& bucket, bool delete_children, optional_yield y)
 {
   int ret;
   map<RGWObjCategory, RGWStorageStats> stats;
@@ -550,7 +550,7 @@ int rgw_remove_bucket(RGWRados *store, rgw_bucket& bucket, bool delete_children)
   do {
     objs.clear();
 
-    ret = list_op.list_objects(max, &objs, &common_prefixes, &is_truncated);
+    ret = list_op.list_objects(max, &objs, &common_prefixes, &is_truncated, null_yield);
     if (ret < 0)
       return ret;
 
@@ -584,7 +584,7 @@ int rgw_remove_bucket(RGWRados *store, rgw_bucket& bucket, bool delete_children)
 
   // if we deleted children above we will force delete, as any that
   // remain is detrius from a prior bug
-  ret = store->delete_bucket(info, objv_tracker, !delete_children);
+  ret = store->delete_bucket(info, objv_tracker, null_yield, !delete_children);
   if (ret < 0) {
     lderr(store->ctx()) << "ERROR: could not remove bucket " <<
       bucket.name << dendl;
@@ -623,7 +623,8 @@ static int drain_handles(list<librados::AioCompletion *>& pending)
 }
 
 int rgw_remove_bucket_bypass_gc(RGWRados *store, rgw_bucket& bucket,
-                                int concurrent_max, bool keep_index_consistent)
+                                int concurrent_max, bool keep_index_consistent,
+                                optional_yield y)
 {
   int ret;
   map<RGWObjCategory, RGWStorageStats> stats;
@@ -665,7 +666,7 @@ int rgw_remove_bucket_bypass_gc(RGWRados *store, rgw_bucket& bucket,
 
   while (is_truncated) {
     objs.clear();
-    ret = list_op.list_objects(max, &objs, &common_prefixes, &is_truncated);
+    ret = list_op.list_objects(max, &objs, &common_prefixes, &is_truncated, null_yield);
     if (ret < 0)
       return ret;
 
@@ -674,7 +675,7 @@ int rgw_remove_bucket_bypass_gc(RGWRados *store, rgw_bucket& bucket,
       RGWObjState *astate = NULL;
       rgw_obj obj(bucket, (*it).key);
 
-      ret = store->get_obj_state(&obj_ctx, info, obj, &astate, false);
+      ret = store->get_obj_state(&obj_ctx, info, obj, &astate, false, y);
       if (ret == -ENOENT) {
         dout(1) << "WARNING: cannot find obj state for obj " << obj.get_oid() << dendl;
         continue;
@@ -749,7 +750,7 @@ int rgw_remove_bucket_bypass_gc(RGWRados *store, rgw_bucket& bucket,
   // this function can only be run if caller wanted children to be
   // deleted, so we can ignore the check for children as any that
   // remain are detritus from a prior bug
-  ret = store->delete_bucket(info, objv_tracker, false);
+  ret = store->delete_bucket(info, objv_tracker, y, false);
   if (ret < 0) {
     lderr(store->ctx()) << "ERROR: could not remove bucket " << bucket.name << dendl;
     return ret;
@@ -957,7 +958,7 @@ int RGWBucket::set_quota(RGWBucketAdminOpState& op_state, std::string *err_msg)
   return r;
 }
 
-int RGWBucket::remove(RGWBucketAdminOpState& op_state, bool bypass_gc,
+int RGWBucket::remove(RGWBucketAdminOpState& op_state, optional_yield y, bool bypass_gc,
                       bool keep_index_consistent, std::string *err_msg)
 {
   bool delete_children = op_state.will_delete_children();
@@ -966,13 +967,13 @@ int RGWBucket::remove(RGWBucketAdminOpState& op_state, bool bypass_gc,
 
   if (bypass_gc) {
     if (delete_children) {
-      ret = rgw_remove_bucket_bypass_gc(store, bucket, op_state.get_max_aio(), keep_index_consistent);
+      ret = rgw_remove_bucket_bypass_gc(store, bucket, op_state.get_max_aio(), keep_index_consistent, y);
     } else {
       set_err_msg(err_msg, "purge objects should be set for gc to be bypassed");
       return -EINVAL;
     }
   } else {
-    ret = rgw_remove_bucket(store, bucket, delete_children);
+    ret = rgw_remove_bucket(store, bucket, delete_children, y);
   }
 
   if (ret < 0) {
@@ -1066,7 +1067,7 @@ int RGWBucket::check_bad_index_multipart(RGWBucketAdminOpState& op_state,
 
   do {
     vector<rgw_bucket_dir_entry> result;
-    int r = list_op.list_objects(max, &result, &common_prefixes, &is_truncated);
+    int r = list_op.list_objects(max, &result, &common_prefixes, &is_truncated, null_yield);
     if (r < 0) {
       set_err_msg(err_msg, "failed to list objects in bucket=" + bucket.name +
               " err=" +  cpp_strerror(-r));
@@ -1146,6 +1147,7 @@ int RGWBucket::check_bad_index_multipart(RGWBucketAdminOpState& op_state,
 
 int RGWBucket::check_object_index(RGWBucketAdminOpState& op_state,
                                   RGWFormatterFlusher& flusher,
+                                  optional_yield y,
                                   std::string *err_msg)
 {
 
@@ -1170,6 +1172,7 @@ int RGWBucket::check_object_index(RGWBucketAdminOpState& op_state,
     int r = store->cls_bucket_list_ordered(bucket_info, RGW_NO_SHARD,
                                           marker, prefix, 1000, true,
                                           result, &is_truncated, &marker,
+                                           y,
                                           bucket_object_check_filter);
     if (r == -ENOENT) {
       break;
@@ -1226,16 +1229,16 @@ int RGWBucket::policy_bl_to_stream(bufferlist& bl, ostream& o)
 
 int rgw_object_get_attr(RGWRados* store, const RGWBucketInfo& bucket_info,
                        const rgw_obj& obj, const char* attr_name,
-                       bufferlist& out_bl)
+                       bufferlist& out_bl, optional_yield y)
 {
   RGWObjectCtx obj_ctx(store);
   RGWRados::Object op_target(store, bucket_info, obj_ctx, obj);
   RGWRados::Object::Read rop(&op_target);
 
-  return rop.get_attr(attr_name, out_bl);
+  return rop.get_attr(attr_name, out_bl, y);
 }
 
-int RGWBucket::get_policy(RGWBucketAdminOpState& op_state, RGWAccessControlPolicy& policy)
+int RGWBucket::get_policy(RGWBucketAdminOpState& op_state, RGWAccessControlPolicy& policy, optional_yield y)
 {
   std::string object_name = op_state.get_object_name();
   rgw_bucket bucket = op_state.get_bucket();
@@ -1252,7 +1255,7 @@ int RGWBucket::get_policy(RGWBucketAdminOpState& op_state, RGWAccessControlPolic
     bufferlist bl;
     rgw_obj obj(bucket, object_name);
 
-    ret = rgw_object_get_attr(store, bucket_info, obj, RGW_ATTR_ACL, bl);
+    ret = rgw_object_get_attr(store, bucket_info, obj, RGW_ATTR_ACL, bl, y);
     if (ret < 0){
       return ret;
     }
@@ -1287,7 +1290,7 @@ int RGWBucketAdminOp::get_policy(RGWRados *store, RGWBucketAdminOpState& op_stat
   if (ret < 0)
     return ret;
 
-  ret = bucket.get_policy(op_state, policy);
+  ret = bucket.get_policy(op_state, policy, null_yield);
   if (ret < 0)
     return ret;
 
@@ -1357,7 +1360,7 @@ int RGWBucketAdminOp::link(RGWRados *store, RGWBucketAdminOpState& op_state, str
 }
 
 int RGWBucketAdminOp::check_index(RGWRados *store, RGWBucketAdminOpState& op_state,
-                  RGWFormatterFlusher& flusher)
+                  RGWFormatterFlusher& flusher, optional_yield y)
 {
   int ret;
   map<RGWObjCategory, RGWStorageStats> existing_stats;
@@ -1377,7 +1380,7 @@ int RGWBucketAdminOp::check_index(RGWRados *store, RGWBucketAdminOpState& op_sta
   if (ret < 0)
     return ret;
 
-  ret = bucket.check_object_index(op_state, flusher);
+  ret = bucket.check_object_index(op_state, flusher, y);
   if (ret < 0)
     return ret;
 
@@ -1392,7 +1395,7 @@ int RGWBucketAdminOp::check_index(RGWRados *store, RGWBucketAdminOpState& op_sta
 }
 
 int RGWBucketAdminOp::remove_bucket(RGWRados *store, RGWBucketAdminOpState& op_state,
-                                    bool bypass_gc, bool keep_index_consistent)
+                                    optional_yield y, bool bypass_gc, bool keep_index_consistent)
 {
   RGWBucket bucket;
 
@@ -1401,7 +1404,7 @@ int RGWBucketAdminOp::remove_bucket(RGWRados *store, RGWBucketAdminOpState& op_s
     return ret;
 
   std::string err_msg;
-  ret = bucket.remove(op_state, bypass_gc, keep_index_consistent, &err_msg);
+  ret = bucket.remove(op_state, y, bypass_gc, keep_index_consistent, &err_msg);
   if (!err_msg.empty()) {
     lderr(store->ctx()) << "ERROR: " << err_msg << dendl;
   }
@@ -1991,7 +1994,7 @@ static bool has_object_expired(RGWRados *store, const RGWBucketInfo& bucket_info
   rgw_obj obj(bucket_info.bucket, key);
   bufferlist delete_at_bl;
 
-  int ret = rgw_object_get_attr(store, bucket_info, obj, RGW_ATTR_DELETE_AT, delete_at_bl);
+  int ret = rgw_object_get_attr(store, bucket_info, obj, RGW_ATTR_DELETE_AT, delete_at_bl, null_yield);
   if (ret < 0) {
     return false;  // no delete at attr, proceed
   }
@@ -2034,7 +2037,7 @@ static int fix_bucket_obj_expiry(RGWRados *store, const RGWBucketInfo& bucket_in
   do {
     std::vector<rgw_bucket_dir_entry> objs;
 
-    int ret = list_op.list_objects(max_objects, &objs, nullptr, &is_truncated);
+    int ret = list_op.list_objects(max_objects, &objs, nullptr, &is_truncated, null_yield);
     if (ret < 0) {
       lderr(store->ctx()) << "ERROR failed to list objects in the bucket" << dendl;
       return ret;
index fec77ba39b3cd6692d574a651765fa15ba67515c..9e7dce4e595b86d1e446c657ed25d722e42978c6 100644 (file)
@@ -209,15 +209,15 @@ extern int rgw_unlink_bucket(RGWRados *store, const rgw_user& user_id,
                              const string& tenant_name, const string& bucket_name, bool update_entrypoint = true);
 
 extern int rgw_remove_object(RGWRados *store, const RGWBucketInfo& bucket_info, const rgw_bucket& bucket, rgw_obj_key& key);
-extern int rgw_remove_bucket(RGWRados *store, rgw_bucket& bucket, bool delete_children);
-extern int rgw_remove_bucket_bypass_gc(RGWRados *store, rgw_bucket& bucket, int concurrent_max);
+extern int rgw_remove_bucket(RGWRados *store, rgw_bucket& bucket, bool delete_children, optional_yield y);
+extern int rgw_remove_bucket_bypass_gc(RGWRados *store, rgw_bucket& bucket, int concurrent_max, optional_yield y);
 
 extern int rgw_bucket_set_attrs(RGWRados *store, RGWBucketInfo& bucket_info,
                                 map<string, bufferlist>& attrs,
                                 RGWObjVersionTracker *objv_tracker);
 extern int rgw_object_get_attr(RGWRados* store, const RGWBucketInfo& bucket_info,
                                const rgw_obj& obj, const char* attr_name,
-                               bufferlist& out_bl);
+                               bufferlist& out_bl, optional_yield y);
 
 extern void check_bad_user_bucket_mapping(RGWRados *store, const rgw_user& user_id, bool fix);
 
@@ -319,6 +319,7 @@ public:
 
   int check_object_index(RGWBucketAdminOpState& op_state,
                          RGWFormatterFlusher& flusher,
+                         optional_yield y,
                          std::string *err_msg = NULL);
 
   int check_index(RGWBucketAdminOpState& op_state,
@@ -326,14 +327,14 @@ public:
           map<RGWObjCategory, RGWStorageStats>& calculated_stats,
           std::string *err_msg = NULL);
 
-  int remove(RGWBucketAdminOpState& op_state, bool bypass_gc = false, bool keep_index_consistent = true, std::string *err_msg = NULL);
+  int remove(RGWBucketAdminOpState& op_state, optional_yield y, bool bypass_gc = false, bool keep_index_consistent = true, std::string *err_msg = NULL);
   int link(RGWBucketAdminOpState& op_state, std::string *err_msg = NULL);
   int unlink(RGWBucketAdminOpState& op_state, std::string *err_msg = NULL);
   int set_quota(RGWBucketAdminOpState& op_state, std::string *err_msg = NULL);
 
   int remove_object(RGWBucketAdminOpState& op_state, std::string *err_msg = NULL);
   int policy_bl_to_stream(bufferlist& bl, ostream& o);
-  int get_policy(RGWBucketAdminOpState& op_state, RGWAccessControlPolicy& policy);
+  int get_policy(RGWBucketAdminOpState& op_state, RGWAccessControlPolicy& policy, optional_yield y);
 
   void clear_failure() { failure = false; }
 
@@ -354,9 +355,9 @@ public:
   static int link(RGWRados *store, RGWBucketAdminOpState& op_state, string *err_msg = NULL);
 
   static int check_index(RGWRados *store, RGWBucketAdminOpState& op_state,
-                  RGWFormatterFlusher& flusher);
+                  RGWFormatterFlusher& flusher, optional_yield y);
 
-  static int remove_bucket(RGWRados *store, RGWBucketAdminOpState& op_state, bool bypass_gc = false, bool keep_index_consistent = true);
+  static int remove_bucket(RGWRados *store, RGWBucketAdminOpState& op_state, optional_yield y, bool bypass_gc = false, bool keep_index_consistent = true);
   static int remove_object(RGWRados *store, RGWBucketAdminOpState& op_state);
   static int info(RGWRados *store, RGWBucketAdminOpState& op_state, RGWFormatterFlusher& flusher);
   static int limit_check(RGWRados *store, RGWBucketAdminOpState& op_state,
index eda3fd19403e758233268fcee4756953d7ccc20f..04f7dd37f4eca5ab2b7e8fbf709b654237dcab27 100644 (file)
@@ -682,7 +682,7 @@ int RGWAsyncRemoveObj::_send_request()
 
   RGWObjState *state;
 
-  int ret = store->get_obj_state(&obj_ctx, bucket_info, obj, &state);
+  int ret = store->get_obj_state(&obj_ctx, bucket_info, obj, &state, null_yield);
   if (ret < 0) {
     ldout(store->ctx(), 20) << __func__ << "(): get_obj_state() obj=" << obj << " returned ret=" << ret << dendl;
     return ret;
@@ -849,7 +849,7 @@ int RGWAsyncStatObj::_send_request()
   rgw_raw_obj raw_obj;
   store->obj_to_raw(bucket_info.placement_rule, obj, &raw_obj);
   return store->raw_obj_stat(raw_obj, psize, pmtime, pepoch,
-                             nullptr, nullptr, objv_tracker);
+                             nullptr, nullptr, objv_tracker, null_yield);
 }
 
 RGWStatObjCR::RGWStatObjCR(RGWAsyncRadosProcessor *async_rados, RGWRados *store,
index 8a79a64310316c016e78e2865ef9a6f34bd6cbd7..b1ae5773cb333d908952a14b9628dddb5e77fc74 100644 (file)
@@ -1552,7 +1552,7 @@ namespace rgw {
                       *static_cast<RGWObjectCtx *>(s->obj_ctx),
                       obj, olh_epoch, s->req_id, this, s->yield);
 
-    op_ret = processor->prepare();
+    op_ret = processor->prepare(s->yield);
     if (op_ret < 0) {
       ldout(s->cct, 20) << "processor->prepare() returned ret=" << op_ret
                        << dendl;
index 3fbb7313e4fb7d6cb451fc07898c62405f5406c0..d51556a54cdbe7b1bb61513791ae62ddfa6fd244 100644 (file)
@@ -325,7 +325,7 @@ static bool pass_object_lock_check(RGWRados *store, RGWBucketInfo& bucket_info,
   RGWRados::Object::Read read_op(&op_target);
   map<string, bufferlist> attrs;
   read_op.params.attrs = &attrs;
-  int ret = read_op.prepare();
+  int ret = read_op.prepare(null_yield);
   if (ret < 0) {
     if (ret == -ENOENT) {
       return true;
@@ -389,7 +389,7 @@ int RGWLC::handle_multipart_expiration(
     do {
       objs.clear();
       list_op.params.marker = list_op.get_next_marker();
-      ret = list_op.list_objects(1000, &objs, NULL, &is_truncated);
+      ret = list_op.list_objects(1000, &objs, NULL, &is_truncated, null_yield);
       if (ret < 0) {
           if (ret == (-ENOENT))
             return 0;
@@ -425,7 +425,7 @@ static int read_obj_tags(RGWRados *store, RGWBucketInfo& bucket_info, rgw_obj& o
   RGWRados::Object op_target(store, bucket_info, ctx, obj);
   RGWRados::Object::Read read_op(&op_target);
 
-  return read_op.get_attr(RGW_ATTR_TAGS, tags_bl);
+  return read_op.get_attr(RGW_ATTR_TAGS, tags_bl, null_yield);
 }
 
 static bool is_valid_op(const lc_op& op)
@@ -490,7 +490,7 @@ public:
   }
 
   int fetch() {
-    int ret = list_op.list_objects(1000, &objs, NULL, &is_truncated);
+    int ret = list_op.list_objects(1000, &objs, NULL, &is_truncated, null_yield);
     if (ret < 0) {
       return ret;
     }
index 689a773b7c409959e5b96b0a214ea510fcd71603..bb45ab69de93d5dd455f1e9d77926e6cbeed2a66 100644 (file)
@@ -316,7 +316,7 @@ int list_bucket_multiparts(RGWRados *store, RGWBucketInfo& bucket_info,
   list_op.params.ns = RGW_OBJ_NS_MULTIPART;
   list_op.params.filter = &mp_filter;
 
-  return(list_op.list_objects(max_uploads, objs, common_prefixes, is_truncated));
+  return(list_op.list_objects(max_uploads, objs, common_prefixes, is_truncated, null_yield));
 }
 
 int abort_bucket_multiparts(RGWRados *store, CephContext *cct, RGWBucketInfo& bucket_info,
index 0fd088f0db241be824977e200ddccaf6344f247a..32971653f7c023ff74b517f3c95bf6a109eabb3f 100644 (file)
@@ -236,7 +236,8 @@ static int get_obj_policy_from_attr(CephContext *cct,
                                    map<string, bufferlist>& bucket_attrs,
                                    RGWAccessControlPolicy *policy,
                                     string *storage_class,
-                                   rgw_obj& obj)
+                                   rgw_obj& obj,
+                                    optional_yield y)
 {
   bufferlist bl;
   int ret = 0;
@@ -244,7 +245,7 @@ static int get_obj_policy_from_attr(CephContext *cct,
   RGWRados::Object op_target(store, bucket_info, obj_ctx, obj);
   RGWRados::Object::Read rop(&op_target);
 
-  ret = rop.get_attr(RGW_ATTR_ACL, bl);
+  ret = rop.get_attr(RGW_ATTR_ACL, bl, null_yield);
   if (ret >= 0) {
     ret = decode_policy(cct, bl, policy);
     if (ret < 0)
@@ -262,7 +263,7 @@ static int get_obj_policy_from_attr(CephContext *cct,
 
   if (storage_class) {
     bufferlist scbl;
-    int r = rop.get_attr(RGW_ATTR_STORAGE_CLASS, scbl);
+    int r = rop.get_attr(RGW_ATTR_STORAGE_CLASS, scbl, y);
     if (r >= 0) {
       *storage_class = scbl.to_str();
     } else {
@@ -327,7 +328,7 @@ static int get_obj_attrs(RGWRados *store, struct req_state *s, const rgw_obj& ob
 
   read_op.params.attrs = &attrs;
 
-  return read_op.prepare();
+  return read_op.prepare(s->yield);
 }
 
 static int get_obj_head(RGWRados *store, struct req_state *s,
@@ -342,7 +343,7 @@ static int get_obj_head(RGWRados *store, struct req_state *s,
 
   read_op.params.attrs = attrs;
 
-  int ret = read_op.prepare();
+  int ret = read_op.prepare(s->yield);
   if (ret < 0) {
     return ret;
   }
@@ -351,7 +352,7 @@ static int get_obj_head(RGWRados *store, struct req_state *s,
     return 0;
   }
 
-  ret = read_op.read(0, s->cct->_conf->rgw_max_chunk_size, *pbl);
+  ret = read_op.read(0, s->cct->_conf->rgw_max_chunk_size, *pbl, s->yield);
 
   return 0;
 }
@@ -447,7 +448,7 @@ static int modify_obj_attr(RGWRados *store, struct req_state *s, const rgw_obj&
 
   read_op.params.attrs = &attrs;
   
-  int r = read_op.prepare();
+  int r = read_op.prepare(s->yield);
   if (r < 0) {
     return r;
   }
@@ -514,7 +515,7 @@ static int read_obj_policy(RGWRados *store,
 
   RGWObjectCtx *obj_ctx = static_cast<RGWObjectCtx *>(s->obj_ctx);
   int ret = get_obj_policy_from_attr(s->cct, store, *obj_ctx,
-                                     bucket_info, bucket_attrs, acl, storage_class, obj);
+                                     bucket_info, bucket_attrs, acl, storage_class, obj, s->yield);
   if (ret == -ENOENT) {
     /* object does not exist checking the bucket's ACL to make sure
        that we send a proper error code */
@@ -1495,7 +1496,7 @@ int RGWGetObj::read_user_manifest_part(rgw_bucket& bucket,
   read_op.params.attrs = &attrs;
   read_op.params.obj_size = &obj_size;
 
-  op_ret = read_op.prepare();
+  op_ret = read_op.prepare(s->yield);
   if (op_ret < 0)
     return op_ret;
   op_ret = read_op.range_to_ofs(ent.meta.accounted_size, cur_ofs, cur_end);
@@ -1594,7 +1595,7 @@ static int iterate_user_manifest_parts(CephContext * const cct,
   MD5 etag_sum;
   do {
 #define MAX_LIST_OBJS 100
-    int r = list_op.list_objects(MAX_LIST_OBJS, &objs, NULL, &is_truncated);
+    int r = list_op.list_objects(MAX_LIST_OBJS, &objs, NULL, &is_truncated, null_yield);
     if (r < 0) {
       return r;
     }
@@ -1986,7 +1987,7 @@ int RGWGetObj::get_data_cb(bufferlist& bl, off_t bl_ofs, off_t bl_len)
   /* garbage collection related handling */
   utime_t start_time = ceph_clock_now();
   if (start_time > gc_invalidate_time) {
-    int r = store->defer_gc(s->obj_ctx, s->bucket_info, obj);
+    int r = store->defer_gc(s->obj_ctx, s->bucket_info, obj, s->yield);
     if (r < 0) {
       ldpp_dout(this, 0) << "WARNING: could not defer gc entry for obj" << dendl;
     }
@@ -2084,7 +2085,7 @@ void RGWGetObj::execute()
   read_op.params.lastmod = &lastmod;
   read_op.params.obj_size = &s->obj_size;
 
-  op_ret = read_op.prepare();
+  op_ret = read_op.prepare(s->yield);
   if (op_ret < 0)
     goto done_err;
   version_id = read_op.state.obj.key.instance;
@@ -2780,7 +2781,7 @@ void RGWListBucket::execute()
   list_op.params.list_versions = list_versions;
   list_op.params.allow_unordered = allow_unordered;
 
-  op_ret = list_op.list_objects(max, &objs, &common_prefixes, &is_truncated);
+  op_ret = list_op.list_objects(max, &objs, &common_prefixes, &is_truncated, s->yield);
   if (op_ret >= 0) {
     next_marker = list_op.get_next_marker();
   }
@@ -3358,7 +3359,7 @@ void RGWDeleteBucket::execute()
      ldpp_dout(this, 1) << "WARNING: failed to sync user stats before bucket delete: op_ret= " << op_ret << dendl;
   }
   
-  op_ret = store->check_bucket_empty(s->bucket_info);
+  op_ret = store->check_bucket_empty(s->bucket_info, s->yield);
   if (op_ret < 0) {
     return;
   }
@@ -3398,7 +3399,7 @@ void RGWDeleteBucket::execute()
     return;
   }
 
-  op_ret = store->delete_bucket(s->bucket_info, ot, false);
+  op_ret = store->delete_bucket(s->bucket_info, ot, s->yield, false);
 
   if (op_ret == -ECANCELED) {
     // lost a race, either with mdlog sync or another delete bucket operation.
@@ -3587,7 +3588,7 @@ int RGWPutObj::get_data(const off_t fst, const off_t lst, bufferlist& bl)
   read_op.params.obj_size = &obj_size;
   read_op.params.attrs = &attrs;
 
-  ret = read_op.prepare();
+  ret = read_op.prepare(s->yield);
   if (ret < 0)
     return ret;
 
@@ -3740,7 +3741,8 @@ void RGWPutObj::execute()
                                           s->bucket_owner.get_id(),
                                           s->bucket_info,
                                           obj,
-                                          this);
+                                          this,
+                                          s->yield);
     if (op_ret < 0) {
       return;
     }
@@ -3802,7 +3804,7 @@ void RGWPutObj::execute()
         s->req_id, this, s->yield);
   }
 
-  op_ret = processor->prepare();
+  op_ret = processor->prepare(s->yield);
   if (op_ret < 0) {
     ldpp_dout(this, 20) << "processor->prepare() returned ret=" << op_ret
                      << dendl;
@@ -3815,7 +3817,7 @@ void RGWPutObj::execute()
 
     RGWObjState *astate;
     op_ret = store->get_obj_state(&obj_ctx, copy_source_bucket_info, obj,
-                                  &astate, true, false);
+                                  &astate, true, s->yield, false);
     if (op_ret < 0) {
       ldpp_dout(this, 0) << "ERROR: get copy source obj state returned with error" << op_ret << dendl;
       return;
@@ -4133,7 +4135,7 @@ void RGWPostObj::execute()
                                     s->bucket_owner.get_id(),
                                     *static_cast<RGWObjectCtx*>(s->obj_ctx),
                                     obj, 0, s->req_id, this, s->yield);
-    op_ret = processor.prepare();
+    op_ret = processor.prepare(s->yield);
     if (op_ret < 0) {
       return;
     }
@@ -5055,7 +5057,8 @@ void RGWCopyObj::execute()
                                         dest_bucket_info.owner,
                                         dest_bucket_info,
                                         dst_obj,
-                                        this);
+                                        this,
+                                        s->yield);
   if (op_ret < 0) {
     return;
   }
@@ -6482,7 +6485,7 @@ bool RGWBulkDelete::Deleter::delete_single(const acct_path_t& path)
     RGWObjVersionTracker ot;
     ot.read_version = binfo.ep_objv;
 
-    ret = store->delete_bucket(binfo, ot);
+    ret = store->delete_bucket(binfo, ot, s->yield);
     if (0 == ret) {
       ret = rgw_unlink_bucket(store, binfo.owner, binfo.bucket.tenant,
                               binfo.bucket.name, false);
@@ -6973,7 +6976,7 @@ int RGWBulkUploadOp::handle_file(const boost::string_ref path,
   AtomicObjectProcessor processor(&*aio, store, binfo, &s->dest_placement, bowner.get_id(),
                                   obj_ctx, obj, 0, s->req_id, this, s->yield);
 
-  op_ret = processor.prepare();
+  op_ret = processor.prepare(s->yield);
   if (op_ret < 0) {
     ldpp_dout(this, 20) << "cannot prepare processor due to ret=" << op_ret << dendl;
     return op_ret;
@@ -7264,14 +7267,14 @@ void RGWGetObjLayout::execute()
                           rgw_obj(s->bucket, s->object));
   RGWRados::Object::Read stat_op(&target);
 
-  op_ret = stat_op.prepare();
+  op_ret = stat_op.prepare(s->yield);
   if (op_ret < 0) {
     return;
   }
 
   head_obj = stat_op.state.head_obj;
 
-  op_ret = target.get_manifest(&manifest);
+  op_ret = target.get_manifest(&manifest, s->yield);
 }
 
 
index 1db4e2a06aec7b6542fb5b40495412a52a168a1d..43573e9a514363082751416b32a4b40b4d47df69 100644 (file)
@@ -553,7 +553,7 @@ int RGWOrphanSearch::build_linked_oids_for_bucket(const string& bucket_instance_
     vector<rgw_bucket_dir_entry> result;
 
     ret = list_op.list_objects(max_list_bucket_entries,
-                               &result, nullptr, &truncated);
+                               &result, nullptr, &truncated, null_yield);
     if (ret < 0) {
       cerr << "ERROR: store->list_objects(): " << cpp_strerror(-ret) << std::endl;
       return -ret;
index 1ff28bfa88862c739a43f9fd566879cb71a2ecd0..27ba7ba1fb1b98fe9ddd622230f6f2026d916455 100644 (file)
@@ -533,7 +533,7 @@ int RGWUserPubSub::SubWithEvents<EventType>::list_events(const string& marker, i
 
   std::vector<rgw_bucket_dir_entry> objs;
 
-  ret = list_op.list_objects(max_events, &objs, nullptr, &list.is_truncated);
+  ret = list_op.list_objects(max_events, &objs, nullptr, &list.is_truncated, null_yield);
   if (ret < 0) {
     ldout(store->ctx(), 1) << "ERROR: failed to list bucket: bucket=" << sub_conf.dest.bucket_name << " ret=" << ret << dendl;
     return ret;
index c38c8e190a4439a93f7294c0c41bdcfe1e901e31..81f50f275b464e7430e06585275b1b4e1e1e76b3 100644 (file)
@@ -199,7 +199,7 @@ int AtomicObjectProcessor::process_first_chunk(bufferlist&& data,
   return 0;
 }
 
-int AtomicObjectProcessor::prepare()
+int AtomicObjectProcessor::prepare(optional_yield y)
 {
   uint64_t max_head_chunk_size;
   uint64_t head_max_size;
@@ -401,7 +401,7 @@ int MultipartObjectProcessor::prepare_head()
   return 0;
 }
 
-int MultipartObjectProcessor::prepare()
+int MultipartObjectProcessor::prepare(optional_yield y)
 {
   manifest.set_prefix(target_obj.key.name + "." + upload_id);
 
@@ -511,10 +511,10 @@ int AppendObjectProcessor::process_first_chunk(bufferlist &&data, rgw::putobj::D
   return 0;
 }
 
-int AppendObjectProcessor::prepare()
+int AppendObjectProcessor::prepare(optional_yield y)
 {
   RGWObjState *astate;
-  int r = store->get_obj_state(&obj_ctx, bucket_info, head_obj, &astate);
+  int r = store->get_obj_state(&obj_ctx, bucket_info, head_obj, &astate, y);
   if (r < 0) {
     return r;
   }
index 7a5d6f2cbfc24f872c02a6ddc1b5799d37106140..2a60c62960824b9e1ec8a3a5fa17044f18fb3951 100644 (file)
@@ -31,7 +31,7 @@ namespace putobj {
 class ObjectProcessor : public DataProcessor {
  public:
   // prepare to start processing object data
-  virtual int prepare() = 0;
+  virtual int prepare(optional_yield y) = 0;
 
   // complete the operation and make its result visible to clients
   virtual int complete(size_t accounted_size, const std::string& etag,
@@ -182,7 +182,7 @@ class AtomicObjectProcessor : public ManifestObjectProcessor {
   {}
 
   // prepare a trivial manifest
-  int prepare() override;
+  int prepare(optional_yield y) override;
   // write the head object atomically in a bucket index transaction
   int complete(size_t accounted_size, const std::string& etag,
                ceph::real_time *mtime, ceph::real_time set_mtime,
@@ -228,7 +228,7 @@ class MultipartObjectProcessor : public ManifestObjectProcessor {
   {}
 
   // prepare a multipart manifest
-  int prepare() override;
+  int prepare(optional_yield y) override;
   // write the head object attributes in a bucket index transaction, then
   // register the completed part with the multipart meta object
   int complete(size_t accounted_size, const std::string& etag,
@@ -266,7 +266,7 @@ class MultipartObjectProcessor : public ManifestObjectProcessor {
               position(position), cur_size(0), cur_accounted_size(cur_accounted_size),
               unique_tag(unique_tag), cur_manifest(nullptr)
     {}
-    int prepare() override;
+    int prepare(optional_yield y) override;
     int complete(size_t accounted_size, const string& etag,
                  ceph::real_time *mtime, ceph::real_time set_mtime,
                  map<string, bufferlist>& attrs, ceph::real_time delete_at,
index 5289f045f876fa46b729395774e1a0665842cefe..69254e73fa783a1a5687e3fc5d5bcefe11587efc 100644 (file)
@@ -2407,7 +2407,8 @@ int RGWRados::Bucket::List::list_objects_ordered(
   int64_t max,
   vector<rgw_bucket_dir_entry> *result,
   map<string, bool> *common_prefixes,
-  bool *is_truncated)
+  bool *is_truncated,
+  optional_yield y)
 {
   RGWRados *store = target->get_store();
   CephContext *cct = store->ctx();
@@ -2465,7 +2466,8 @@ int RGWRados::Bucket::List::list_objects_ordered(
                                           params.list_versions,
                                           ent_map,
                                           &truncated,
-                                          &cur_marker);
+                                          &cur_marker,
+                                           y);
     if (r < 0)
       return r;
 
@@ -2592,7 +2594,8 @@ done:
 int RGWRados::Bucket::List::list_objects_unordered(int64_t max,
                                                   vector<rgw_bucket_dir_entry> *result,
                                                   map<string, bool> *common_prefixes,
-                                                  bool *is_truncated)
+                                                  bool *is_truncated,
+                                                   optional_yield y)
 {
   RGWRados *store = target->get_store();
   CephContext *cct = store->ctx();
@@ -2636,7 +2639,8 @@ int RGWRados::Bucket::List::list_objects_unordered(int64_t max,
                                             params.list_versions,
                                             ent_list,
                                             &truncated,
-                                            &cur_marker);
+                                            &cur_marker,
+                                             y);
     if (r < 0)
       return r;
 
@@ -3117,7 +3121,7 @@ done_err:
  * fixes an issue where head objects were supposed to have a locator created, but ended
  * up without one
  */
-int RGWRados::fix_tail_obj_locator(const RGWBucketInfo& bucket_info, rgw_obj_key& key, bool fix, bool *need_fix)
+int RGWRados::fix_tail_obj_locator(const RGWBucketInfo& bucket_info, rgw_obj_key& key, bool fix, bool *need_fix, optional_yield y)
 {
   const rgw_bucket& bucket = bucket_info.bucket;
   rgw_obj obj(bucket, key);
@@ -3134,7 +3138,7 @@ int RGWRados::fix_tail_obj_locator(const RGWBucketInfo& bucket_info, rgw_obj_key
 
   RGWObjState *astate = NULL;
   RGWObjectCtx rctx(this);
-  r = get_obj_state(&rctx, bucket_info, obj, &astate, false);
+  r = get_obj_state(&rctx, bucket_info, obj, &astate, false, y);
   if (r < 0)
     return r;
 
@@ -3309,7 +3313,7 @@ int RGWRados::on_last_entry_in_listing(RGWBucketInfo& bucket_info,
     std::vector<rgw_bucket_dir_entry> entries(MAX_LIST_OBJS);
 
     int ret = list_op.list_objects(MAX_LIST_OBJS, &entries, nullptr,
-                                   &is_truncated);
+                                   &is_truncated, null_yield);
     if (ret < 0) {
       return ret;
     } else if (!entries.empty()) {
@@ -3330,7 +3334,8 @@ int RGWRados::swift_versioning_copy(RGWObjectCtx& obj_ctx,
                                     const rgw_user& user,
                                     RGWBucketInfo& bucket_info,
                                     rgw_obj& obj, 
-                                    const DoutPrefixProvider *dpp)
+                                    const DoutPrefixProvider *dpp,
+                                    optional_yield y)
 {
   if (! swift_versioning_enabled(bucket_info)) {
     return 0;
@@ -3339,7 +3344,7 @@ int RGWRados::swift_versioning_copy(RGWObjectCtx& obj_ctx,
   obj_ctx.set_atomic(obj);
 
   RGWObjState * state = nullptr;
-  int r = get_obj_state(&obj_ctx, bucket_info, obj, &state, false);
+  int r = get_obj_state(&obj_ctx, bucket_info, obj, &state, false, y);
   if (r < 0) {
     return r;
   }
@@ -3551,7 +3556,7 @@ int RGWRados::Object::Write::_do_write_meta(uint64_t size, uint64_t accounted_si
 #endif
 
   RGWObjState *state;
-  int r = target->get_state(&state, false, assume_noent);
+  int r = target->get_state(&state, false, y, assume_noent);
   if (r < 0)
     return r;
 
@@ -3575,7 +3580,7 @@ int RGWRados::Object::Write::_do_write_meta(uint64_t size, uint64_t accounted_si
   if (!ptag && !index_op->get_optag()->empty()) {
     ptag = index_op->get_optag();
   }
-  r = target->prepare_atomic_modification(op, reset_obj, ptag, meta.if_match, meta.if_nomatch, false, modify_tail);
+  r = target->prepare_atomic_modification(op, reset_obj, ptag, meta.if_match, meta.if_nomatch, false, modify_tail, y);
   if (r < 0)
     return r;
 
@@ -3739,7 +3744,7 @@ int RGWRados::Object::Write::_do_write_meta(uint64_t size, uint64_t accounted_si
   state = NULL;
 
   if (versioned_op && meta.olh_epoch) {
-    r = store->set_olh(target->get_ctx(), target->get_bucket_info(), obj, false, NULL, *meta.olh_epoch, real_time(), false, meta.zones_trace);
+    r = store->set_olh(target->get_ctx(), target->get_bucket_info(), obj, false, NULL, *meta.olh_epoch, real_time(), false, y, meta.zones_trace);
     if (r < 0) {
       return r;
     }
@@ -4027,7 +4032,7 @@ int RGWRados::rewrite_obj(RGWBucketInfo& dest_bucket_info, const rgw_obj& obj, c
   read_op.params.lastmod = &mtime;
   read_op.params.obj_size = &obj_size;
 
-  int ret = read_op.prepare();
+  int ret = read_op.prepare(y);
   if (ret < 0)
     return ret;
 
@@ -4344,7 +4349,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
                         }
                       }
 
-                      int ret = processor.prepare();
+                      int ret = processor.prepare(null_yield);
                       if (ret < 0) {
                         return ret;
                       }
@@ -4363,7 +4368,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
 
   if (copy_if_newer) {
     /* need to get mtime for destination */
-    ret = get_obj_state(&obj_ctx, dest_bucket_info, dest_obj, &dest_state, false);
+    ret = get_obj_state(&obj_ctx, dest_bucket_info, dest_obj, &dest_state, false, null_yield);
     if (ret < 0)
       goto set_err_state;
 
@@ -4473,7 +4478,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
     if (copy_if_newer && canceled) {
       ldout(cct, 20) << "raced with another write of obj: " << dest_obj << dendl;
       obj_ctx.invalidate(dest_obj); /* object was overwritten */
-      ret = get_obj_state(&obj_ctx, dest_bucket_info, dest_obj, &dest_state, false);
+      ret = get_obj_state(&obj_ctx, dest_bucket_info, dest_obj, &dest_state, false, null_yield);
       if (ret < 0) {
         ldout(cct, 0) << "ERROR: " << __func__ << ": get_err_state() returned ret=" << ret << dendl;
         goto set_err_state;
@@ -4508,7 +4513,7 @@ set_err_state:
     if (olh_epoch && *olh_epoch > 0) {
       constexpr bool log_data_change = true;
       ret = set_olh(obj_ctx, dest_bucket_info, dest_obj, false, nullptr,
-                    *olh_epoch, real_time(), false, zones_trace, log_data_change);
+                    *olh_epoch, real_time(), false, null_yield, zones_trace, log_data_change);
     } else {
       // we already have the latest copy
       ret = 0;
@@ -4639,7 +4644,7 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx,
   read_op.params.lastmod = src_mtime;
   read_op.params.obj_size = &obj_size;
 
-  ret = read_op.prepare();
+  ret = read_op.prepare(y);
   if (ret < 0) {
     return ret;
   }
@@ -4667,7 +4672,7 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx,
   RGWObjManifest manifest;
   RGWObjState *astate = NULL;
 
-  ret = get_obj_state(&obj_ctx, src_bucket_info, src_obj, &astate);
+  ret = get_obj_state(&obj_ctx, src_bucket_info, src_obj, &astate, y);
   if (ret < 0) {
     return ret;
   }
@@ -4809,7 +4814,7 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx,
   }
 
   if (copy_first) {
-    ret = read_op.read(0, max_chunk_size, first_chunk);
+    ret = read_op.read(0, max_chunk_size, first_chunk, y);
     if (ret < 0) {
       goto done_ret;
     }
@@ -4880,7 +4885,7 @@ int RGWRados::copy_obj_data(RGWObjectCtx& obj_ctx,
   AtomicObjectProcessor processor(&aio, this, dest_bucket_info, &dest_placement,
                                   dest_bucket_info.owner, obj_ctx,
                                   dest_obj, olh_epoch, tag, dpp, y);
-  int ret = processor.prepare();
+  int ret = processor.prepare(y);
   if (ret < 0)
     return ret;
 
@@ -4888,7 +4893,7 @@ int RGWRados::copy_obj_data(RGWObjectCtx& obj_ctx,
 
   do {
     bufferlist bl;
-    ret = read_op.read(ofs, end, bl);
+    ret = read_op.read(ofs, end, bl, y);
     if (ret < 0) {
       ldpp_dout(dpp, 0) << "ERROR: fail to read object data, ret = " << ret << dendl;
       return ret;
@@ -4956,7 +4961,7 @@ int RGWRados::transition_obj(RGWObjectCtx& obj_ctx,
   read_op.params.lastmod = &read_mtime;
   read_op.params.obj_size = &obj_size;
 
-  int ret = read_op.prepare();
+  int ret = read_op.prepare(y);
   if (ret < 0) {
     return ret;
   }
@@ -4987,7 +4992,7 @@ int RGWRados::transition_obj(RGWObjectCtx& obj_ctx,
   return 0;
 }
 
-int RGWRados::check_bucket_empty(RGWBucketInfo& bucket_info)
+int RGWRados::check_bucket_empty(RGWBucketInfo& bucket_info, optional_yield y)
 {
   std::vector<rgw_bucket_dir_entry> ent_list;
   rgw_obj_index_key marker;
@@ -5004,7 +5009,8 @@ int RGWRados::check_bucket_empty(RGWBucketInfo& bucket_info)
                                      true,
                                      ent_list,
                                      &is_truncated,
-                                     &marker);
+                                     &marker,
+                                      y);
     if (r < 0)
       return r;
 
@@ -5025,7 +5031,7 @@ int RGWRados::check_bucket_empty(RGWBucketInfo& bucket_info)
  * bucket: the name of the bucket to delete
  * Returns 0 on success, -ERR# otherwise.
  */
-int RGWRados::delete_bucket(RGWBucketInfo& bucket_info, RGWObjVersionTracker& objv_tracker, bool check_empty)
+int RGWRados::delete_bucket(RGWBucketInfo& bucket_info, RGWObjVersionTracker& objv_tracker, optional_yield y, bool check_empty)
 {
   const rgw_bucket& bucket = bucket_info.bucket;
   librados::IoCtx index_ctx;
@@ -5035,7 +5041,7 @@ int RGWRados::delete_bucket(RGWBucketInfo& bucket_info, RGWObjVersionTracker& ob
     return r;
   
   if (check_empty) {
-    r = check_bucket_empty(bucket_info);
+    r = check_bucket_empty(bucket_info, y);
     if (r < 0) {
       return r;
     }
@@ -5365,7 +5371,7 @@ int RGWRados::bucket_set_reshard(const RGWBucketInfo& bucket_info, const cls_rgw
   return CLSRGWIssueSetBucketResharding(index_ctx, bucket_objs, entry, cct->_conf->rgw_bucket_index_max_aio)();
 }
 
-int RGWRados::defer_gc(void *ctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj)
+int RGWRados::defer_gc(void *ctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, optional_yield y)
 {
   RGWObjectCtx *rctx = static_cast<RGWObjectCtx *>(ctx);
   std::string oid, key;
@@ -5375,7 +5381,7 @@ int RGWRados::defer_gc(void *ctx, const RGWBucketInfo& bucket_info, const rgw_ob
 
   RGWObjState *state = NULL;
 
-  int r = get_obj_state(rctx, bucket_info, obj, &state, false);
+  int r = get_obj_state(rctx, bucket_info, obj, &state, false, y);
   if (r < 0)
     return r;
 
@@ -5465,7 +5471,7 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y)
         meta.mtime = params.mtime;
       }
 
-      int r = store->set_olh(target->get_ctx(), target->get_bucket_info(), marker, true, &meta, params.olh_epoch, params.unmod_since, params.high_precision_time, params.zones_trace);
+      int r = store->set_olh(target->get_ctx(), target->get_bucket_info(), marker, true, &meta, params.olh_epoch, params.unmod_since, params.high_precision_time, y, params.zones_trace);
       if (r < 0) {
         return r;
       }
@@ -5477,7 +5483,7 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y)
         return r;
       }
       result.delete_marker = dirent.is_delete_marker();
-      r = store->unlink_obj_instance(target->get_ctx(), target->get_bucket_info(), obj, params.olh_epoch, params.zones_trace);
+      r = store->unlink_obj_instance(target->get_ctx(), target->get_bucket_info(), obj, params.olh_epoch, y, params.zones_trace);
       if (r < 0) {
         return r;
       }
@@ -5509,7 +5515,7 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y)
   }
 
   RGWObjState *state;
-  r = target->get_state(&state, false);
+  r = target->get_state(&state, false, y);
   if (r < 0)
     return r;
 
@@ -5559,7 +5565,7 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y)
     return -ENOENT;
   }
 
-  r = target->prepare_atomic_modification(op, false, NULL, NULL, NULL, true, false);
+  r = target->prepare_atomic_modification(op, false, NULL, NULL, NULL, true, false, y);
   if (r < 0)
     return r;
 
@@ -5718,7 +5724,7 @@ static bool has_olh_tag(map<string, bufferlist>& attrs)
 }
 
 int RGWRados::get_olh_target_state(RGWObjectCtx& obj_ctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj,
-                                   RGWObjState *olh_state, RGWObjState **target_state)
+                                   RGWObjState *olh_state, RGWObjState **target_state, optional_yield y)
 {
   ceph_assert(olh_state->is_olh);
 
@@ -5727,7 +5733,7 @@ int RGWRados::get_olh_target_state(RGWObjectCtx& obj_ctx, const RGWBucketInfo& b
   if (r < 0) {
     return r;
   }
-  r = get_obj_state(&obj_ctx, bucket_info, target, target_state, false);
+  r = get_obj_state(&obj_ctx, bucket_info, target, target_state, false, y);
   if (r < 0) {
     return r;
   }
@@ -5736,7 +5742,7 @@ int RGWRados::get_olh_target_state(RGWObjectCtx& obj_ctx, const RGWBucketInfo& b
 }
 
 int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj,
-                                 RGWObjState **state, bool follow_olh, bool assume_noent)
+                                 RGWObjState **state, bool follow_olh, optional_yield y, bool assume_noent)
 {
   if (obj.empty()) {
     return -EINVAL;
@@ -5749,7 +5755,7 @@ int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, const RGWBucketInfo& bucket
   *state = s;
   if (s->has_attrs) {
     if (s->is_olh && need_follow_olh) {
-      return get_olh_target_state(*rctx, bucket_info, obj, s, state);
+      return get_olh_target_state(*rctx, bucket_info, obj, s, state, y);
     }
     return 0;
   }
@@ -5762,7 +5768,7 @@ int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, const RGWBucketInfo& bucket
   int r = -ENOENT;
 
   if (!assume_noent) {
-    r = RGWRados::raw_obj_stat(raw_obj, &s->size, &s->mtime, &s->epoch, &s->attrset, (s->prefetch_data ? &s->data : NULL), NULL);
+    r = RGWRados::raw_obj_stat(raw_obj, &s->size, &s->mtime, &s->epoch, &s->attrset, (s->prefetch_data ? &s->data : NULL), NULL, y);
   }
 
   if (r == -ENOENT) {
@@ -5902,7 +5908,7 @@ int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, const RGWBucketInfo& bucket
     ldout(cct, 20) << __func__ << ": setting s->olh_tag to " << string(s->olh_tag.c_str(), s->olh_tag.length()) << dendl;
 
     if (need_follow_olh) {
-      return get_olh_target_state(*rctx, bucket_info, obj, s, state);
+      return get_olh_target_state(*rctx, bucket_info, obj, s, state, y);
     } else if (obj.key.have_null_instance() && !s->has_manifest) {
       // read null version, and the head object only have olh info
       s->exists = false;
@@ -5914,21 +5920,21 @@ int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, const RGWBucketInfo& bucket
 }
 
 int RGWRados::get_obj_state(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state,
-                            bool follow_olh, bool assume_noent)
+                            bool follow_olh, optional_yield y, bool assume_noent)
 {
   int ret;
 
   do {
-    ret = get_obj_state_impl(rctx, bucket_info, obj, state, follow_olh, assume_noent);
+    ret = get_obj_state_impl(rctx, bucket_info, obj, state, follow_olh, y, assume_noent);
   } while (ret == -EAGAIN);
 
   return ret;
 }
 
-int RGWRados::Object::get_manifest(RGWObjManifest **pmanifest)
+int RGWRados::Object::get_manifest(RGWObjManifest **pmanifest, optional_yield y)
 {
   RGWObjState *astate;
-  int r = get_state(&astate, true);
+  int r = get_state(&astate, true, y);
   if (r < 0) {
     return r;
   }
@@ -5938,10 +5944,10 @@ int RGWRados::Object::get_manifest(RGWObjManifest **pmanifest)
   return 0;
 }
 
-int RGWRados::Object::Read::get_attr(const char *name, bufferlist& dest)
+int RGWRados::Object::Read::get_attr(const char *name, bufferlist& dest, optional_yield y)
 {
   RGWObjState *state;
-  int r = source->get_state(&state, true);
+  int r = source->get_state(&state, true, y);
   if (r < 0)
     return r;
   if (!state->exists)
@@ -6035,12 +6041,12 @@ int RGWRados::Object::Stat::finish()
 
 int RGWRados::append_atomic_test(RGWObjectCtx *rctx,
                                  const RGWBucketInfo& bucket_info, const rgw_obj& obj,
-                                 ObjectOperation& op, RGWObjState **pstate)
+                                 ObjectOperation& op, RGWObjState **pstate, optional_yield y)
 {
   if (!rctx)
     return 0;
 
-  int r = get_obj_state(rctx, bucket_info, obj, pstate, false);
+  int r = get_obj_state(rctx, bucket_info, obj, pstate, false, y);
   if (r < 0)
     return r;
 
@@ -6063,9 +6069,9 @@ int RGWRados::append_atomic_test(const RGWObjState* state,
   return 0;
 }
 
-int RGWRados::Object::get_state(RGWObjState **pstate, bool follow_olh, bool assume_noent)
+int RGWRados::Object::get_state(RGWObjState **pstate, bool follow_olh, optional_yield y, bool assume_noent)
 {
-  return store->get_obj_state(&ctx, bucket_info, obj, pstate, follow_olh, assume_noent);
+  return store->get_obj_state(&ctx, bucket_info, obj, pstate, follow_olh, y, assume_noent);
 }
 
 void RGWRados::Object::invalidate_state()
@@ -6075,9 +6081,9 @@ void RGWRados::Object::invalidate_state()
 
 int RGWRados::Object::prepare_atomic_modification(ObjectWriteOperation& op, bool reset_obj, const string *ptag,
                                                   const char *if_match, const char *if_nomatch, bool removal_op,
-                                                  bool modify_tail)
+                                                  bool modify_tail, optional_yield y)
 {
-  int r = get_state(&state, false);
+  int r = get_state(&state, false, y);
   if (r < 0)
     return r;
 
@@ -6201,7 +6207,7 @@ int RGWRados::set_attrs(void *ctx, const RGWBucketInfo& bucket_info, rgw_obj& sr
   ObjectWriteOperation op;
   RGWObjState *state = NULL;
 
-  r = append_atomic_test(rctx, bucket_info, obj, op, &state);
+  r = append_atomic_test(rctx, bucket_info, obj, op, &state, y);
   if (r < 0)
     return r;
 
@@ -6313,7 +6319,7 @@ int RGWRados::set_attrs(void *ctx, const RGWBucketInfo& bucket_info, rgw_obj& sr
   return 0;
 }
 
-int RGWRados::Object::Read::prepare()
+int RGWRados::Object::Read::prepare(optional_yield y)
 {
   RGWRados *store = source->get_store();
   CephContext *cct = store->ctx();
@@ -6323,7 +6329,7 @@ int RGWRados::Object::Read::prepare()
   map<string, bufferlist>::iterator iter;
 
   RGWObjState *astate;
-  int r = source->get_state(&astate, true);
+  int r = source->get_state(&astate, true, y);
   if (r < 0)
     return r;
 
@@ -6378,7 +6384,7 @@ int RGWRados::Object::Read::prepare()
     }
   }
   if (conds.if_match || conds.if_nomatch) {
-    r = get_attr(RGW_ATTR_ETAG, etag);
+    r = get_attr(RGW_ATTR_ETAG, etag, y);
     if (r < 0)
       return r;
 
@@ -6617,7 +6623,7 @@ int RGWRados::Bucket::UpdateIndex::cancel()
   return ret;
 }
 
-int RGWRados::Object::Read::read(int64_t ofs, int64_t end, bufferlist& bl)
+int RGWRados::Object::Read::read(int64_t ofs, int64_t end, bufferlist& bl, optional_yield y)
 {
   RGWRados *store = source->get_store();
   CephContext *cct = store->ctx();
@@ -6634,7 +6640,7 @@ int RGWRados::Object::Read::read(int64_t ofs, int64_t end, bufferlist& bl)
   uint64_t max_chunk_size;
 
   RGWObjState *astate;
-  int r = source->get_state(&astate, true);
+  int r = source->get_state(&astate, true, y);
   if (r < 0)
     return r;
 
@@ -6676,7 +6682,7 @@ int RGWRados::Object::Read::read(int64_t ofs, int64_t end, bufferlist& bl)
 
   if (reading_from_head) {
     /* only when reading from the head object do we need to do the atomic test */
-    r = store->append_atomic_test(&source->get_ctx(), source->get_bucket_info(), state.obj, op, &astate);
+    r = store->append_atomic_test(&source->get_ctx(), source->get_bucket_info(), state.obj, op, &astate, y);
     if (r < 0)
       return r;
 
@@ -6860,7 +6866,7 @@ int RGWRados::Object::Read::iterate(int64_t ofs, int64_t end, RGWGetDataCB *cb,
   get_obj_data data(store, cb, &*aio, ofs, y);
 
   int r = store->iterate_obj(obj_ctx, source->get_bucket_info(), state.obj,
-                             ofs, end, chunk_size, _get_obj_iterate_cb, &data);
+                             ofs, end, chunk_size, _get_obj_iterate_cb, &data, y);
   if (r < 0) {
     ldout(cct, 0) << "iterate_obj() failed with " << r << dendl;
     data.cancel(); // drain completions without writing back to client
@@ -6873,7 +6879,7 @@ int RGWRados::Object::Read::iterate(int64_t ofs, int64_t end, RGWGetDataCB *cb,
 int RGWRados::iterate_obj(RGWObjectCtx& obj_ctx,
                           const RGWBucketInfo& bucket_info, const rgw_obj& obj,
                           off_t ofs, off_t end, uint64_t max_chunk_size,
-                          iterate_obj_cb cb, void *arg)
+                          iterate_obj_cb cb, void *arg, optional_yield y)
 {
   rgw_raw_obj head_obj;
   rgw_raw_obj read_obj;
@@ -6884,7 +6890,7 @@ int RGWRados::iterate_obj(RGWObjectCtx& obj_ctx,
 
   obj_to_raw(bucket_info.placement_rule, obj, &head_obj);
 
-  int r = get_obj_state(&obj_ctx, bucket_info, obj, &astate, false);
+  int r = get_obj_state(&obj_ctx, bucket_info, obj, &astate, false, y);
   if (r < 0) {
     return r;
   }
@@ -7614,7 +7620,7 @@ int RGWRados::update_olh(RGWObjectCtx& obj_ctx, RGWObjState *state, const RGWBuc
 
 int RGWRados::set_olh(RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_info, const rgw_obj& target_obj, bool delete_marker, rgw_bucket_dir_entry_meta *meta,
                       uint64_t olh_epoch, real_time unmod_since, bool high_precision_time,
-                      rgw_zone_set *zones_trace, bool log_data_change)
+                      optional_yield y, rgw_zone_set *zones_trace, bool log_data_change)
 {
   string op_tag;
 
@@ -7632,7 +7638,7 @@ int RGWRados::set_olh(RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_info, const r
       obj_ctx.invalidate(olh_obj);
     }
 
-    ret = get_obj_state(&obj_ctx, bucket_info, olh_obj, &state, false); /* don't follow olh */
+    ret = get_obj_state(&obj_ctx, bucket_info, olh_obj, &state, false, y); /* don't follow olh */
     if (ret < 0) {
       return ret;
     }
@@ -7682,7 +7688,7 @@ int RGWRados::set_olh(RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_info, const r
 }
 
 int RGWRados::unlink_obj_instance(RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_info, const rgw_obj& target_obj,
-                                  uint64_t olh_epoch, rgw_zone_set *zones_trace)
+                                  uint64_t olh_epoch, optional_yield y, rgw_zone_set *zones_trace)
 {
   string op_tag;
 
@@ -7699,7 +7705,7 @@ int RGWRados::unlink_obj_instance(RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_i
       obj_ctx.invalidate(olh_obj);
     }
 
-    ret = get_obj_state(&obj_ctx, bucket_info, olh_obj, &state, false); /* don't follow olh */
+    ret = get_obj_state(&obj_ctx, bucket_info, olh_obj, &state, false, y); /* don't follow olh */
     if (ret < 0)
       return ret;
 
@@ -7901,7 +7907,7 @@ int RGWRados::follow_olh(const RGWBucketInfo& bucket_info, RGWObjectCtx& obj_ctx
 
 int RGWRados::raw_obj_stat(rgw_raw_obj& obj, uint64_t *psize, real_time *pmtime, uint64_t *epoch,
                            map<string, bufferlist> *attrs, bufferlist *first_chunk,
-                           RGWObjVersionTracker *objv_tracker)
+                           RGWObjVersionTracker *objv_tracker, optional_yield y)
 {
   rgw_rados_ref ref;
   int r = get_raw_obj_ref(obj, &ref);
@@ -7927,7 +7933,8 @@ int RGWRados::raw_obj_stat(rgw_raw_obj& obj, uint64_t *psize, real_time *pmtime,
     op.read(0, cct->_conf->rgw_max_chunk_size, first_chunk, NULL);
   }
   bufferlist outbl;
-  r = ref.ioctx.operate(ref.obj.oid, &op, &outbl);
+
+  r = rgw_rados_operate(ref.ioctx, ref.obj.oid, &op, &outbl, y);
 
   if (epoch) {
     *epoch = ref.ioctx.get_last_version();
@@ -9109,6 +9116,7 @@ int RGWRados::cls_bucket_list_ordered(RGWBucketInfo& bucket_info,
                                      map<string, rgw_bucket_dir_entry>& m,
                                      bool *is_truncated,
                                      rgw_obj_index_key *last_entry,
+                                      optional_yield y,
                                      bool (*force_check_filter)(const string& name))
 {
   ldout(cct, 10) << "cls_bucket_list_ordered " << bucket_info.bucket <<
@@ -9177,7 +9185,7 @@ int RGWRados::cls_bucket_list_ordered(RGWBucketInfo& bucket_info,
       librados::IoCtx sub_ctx;
       sub_ctx.dup(index_ctx);
       r = check_disk_state(sub_ctx, bucket_info, dirent, dirent,
-                          updates[vnames[pos]]);
+                          updates[vnames[pos]], y);
       if (r < 0 && r != -ENOENT) {
           return r;
       }
@@ -9233,6 +9241,7 @@ int RGWRados::cls_bucket_list_unordered(RGWBucketInfo& bucket_info,
                                        std::vector<rgw_bucket_dir_entry>& ent_list,
                                        bool *is_truncated,
                                        rgw_obj_index_key *last_entry,
+                                        optional_yield y,
                                        bool (*force_check_filter)(const string& name)) {
   ldout(cct, 10) << "cls_bucket_list_unordered " << bucket_info.bucket <<
     " start " << start.name << "[" << start.instance <<
@@ -9317,7 +9326,8 @@ int RGWRados::cls_bucket_list_unordered(RGWBucketInfo& bucket_info,
         * and if the tags are old we need to do cleanup as well. */
        librados::IoCtx sub_ctx;
        sub_ctx.dup(index_ctx);
-       r = check_disk_state(sub_ctx, bucket_info, dirent, dirent, updates[oid]);
+       r = check_disk_state(sub_ctx, bucket_info, dirent, dirent, updates[oid]
+            , null_yield);
        if (r < 0 && r != -ENOENT) {
          return r;
        }
@@ -9476,7 +9486,8 @@ int RGWRados::check_disk_state(librados::IoCtx io_ctx,
                                const RGWBucketInfo& bucket_info,
                                rgw_bucket_dir_entry& list_state,
                                rgw_bucket_dir_entry& object,
-                               bufferlist& suggested_updates)
+                               bufferlist& suggested_updates,
+                               optional_yield y)
 {
   const rgw_bucket& bucket = bucket_info.bucket;
   uint8_t suggest_flag = (svc.zone->get_zone().log_data ? CEPH_RGW_DIR_SUGGEST_LOG_OP : 0);
@@ -9496,7 +9507,7 @@ int RGWRados::check_disk_state(librados::IoCtx io_ctx,
 
   RGWObjState *astate = NULL;
   RGWObjectCtx rctx(this);
-  int r = get_obj_state(&rctx, bucket_info, obj, &astate, false);
+  int r = get_obj_state(&rctx, bucket_info, obj, &astate, false, y);
   if (r < 0)
     return r;
 
index 20b1e360f6961ed8c11cdadeb9ea33f97a3e3c58..235dfab0a0954cb4fed2d02fa03836a0b3fdf73b 100644 (file)
@@ -1253,11 +1253,11 @@ class RGWRados : public AdminSocketHook
   uint64_t max_bucket_id;
 
   int get_olh_target_state(RGWObjectCtx& rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj,
-                           RGWObjState *olh_state, RGWObjState **target_state);
+                           RGWObjState *olh_state, RGWObjState **target_state, optional_yield y);
   int get_obj_state_impl(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state,
-                         bool follow_olh, bool assume_noent = false);
+                         bool follow_olh, optional_yield y, bool assume_noent = false);
   int append_atomic_test(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj,
-                         librados::ObjectOperation& op, RGWObjState **state);
+                         librados::ObjectOperation& op, RGWObjState **state, optional_yield y);
   int append_atomic_test(const RGWObjState* astate, librados::ObjectOperation& op);
 
   int update_placement_map();
@@ -1498,11 +1498,11 @@ public:
     bool bs_initialized;
 
   protected:
-    int get_state(RGWObjState **pstate, bool follow_olh, bool assume_noent = false);
+    int get_state(RGWObjState **pstate, bool follow_olh, optional_yield y, bool assume_noent = false);
     void invalidate_state();
 
     int prepare_atomic_modification(librados::ObjectWriteOperation& op, bool reset_obj, const string *ptag,
-                                    const char *ifmatch, const char *ifnomatch, bool removal_op, bool modify_tail);
+                                    const char *ifmatch, const char *ifnomatch, bool removal_op, bool modify_tail, optional_yield y);
     int complete_atomic_modification();
 
   public:
@@ -1515,7 +1515,7 @@ public:
     rgw_obj& get_obj() { return obj; }
     RGWObjectCtx& get_ctx() { return ctx; }
     RGWBucketInfo& get_bucket_info() { return bucket_info; }
-    int get_manifest(RGWObjManifest **pmanifest);
+    int get_manifest(RGWObjManifest **pmanifest, optional_yield y);
 
     int get_bucket_shard(BucketShard **pbs) {
       if (!bs_initialized) {
@@ -1573,11 +1573,11 @@ public:
 
       explicit Read(RGWRados::Object *_source) : source(_source) {}
 
-      int prepare();
+      int prepare(optional_yield y);
       static int range_to_ofs(uint64_t obj_size, int64_t &ofs, int64_t &end);
-      int read(int64_t ofs, int64_t end, bufferlist& bl);
+      int read(int64_t ofs, int64_t end, bufferlist& bl, optional_yield y);
       int iterate(int64_t ofs, int64_t end, RGWGetDataCB *cb, optional_yield y);
-      int get_attr(const char *name, bufferlist& dest);
+      int get_attr(const char *name, bufferlist& dest, optional_yield y);
     };
 
     struct Write {
@@ -1788,11 +1788,13 @@ public:
       int list_objects_ordered(int64_t max,
                               vector<rgw_bucket_dir_entry> *result,
                               map<string, bool> *common_prefixes,
-                              bool *is_truncated);
+                              bool *is_truncated,
+                               optional_yield y);
       int list_objects_unordered(int64_t max,
                                 vector<rgw_bucket_dir_entry> *result,
                                 map<string, bool> *common_prefixes,
-                                bool *is_truncated);
+                                bool *is_truncated,
+                                 optional_yield y);
 
     public:
 
@@ -1820,13 +1822,14 @@ public:
       int list_objects(int64_t max,
                       vector<rgw_bucket_dir_entry> *result,
                       map<string, bool> *common_prefixes,
-                      bool *is_truncated) {
+                      bool *is_truncated,
+                       optional_yield y) {
        if (params.allow_unordered) {
          return list_objects_unordered(max, result, common_prefixes,
-                                       is_truncated);
+                                       is_truncated, y);
        } else {
          return list_objects_ordered(max, result, common_prefixes,
-                                     is_truncated);
+                                     is_truncated, y);
        }
       }
       rgw_obj_key& get_next_marker() {
@@ -1849,7 +1852,8 @@ public:
                             const rgw_user& user,               /* in */
                             RGWBucketInfo& bucket_info,         /* in */
                             rgw_obj& obj,                       /* in */
-                            const DoutPrefixProvider *dpp);     /* in/out */                
+                            const DoutPrefixProvider *dpp,      /* in/out */ 
+                            optional_yield y);                  /* in */                
   int swift_versioning_restore(RGWSysObjectCtx& sysobj_ctx,
                                RGWObjectCtx& obj_ctx,           /* in/out */
                                const rgw_user& user,            /* in */
@@ -1987,14 +1991,14 @@ public:
                      const DoutPrefixProvider *dpp,
                      optional_yield y);
 
-  int check_bucket_empty(RGWBucketInfo& bucket_info);
+  int check_bucket_empty(RGWBucketInfo& bucket_info, optional_yield y);
 
   /**
    * Delete a bucket.
    * bucket: the name of the bucket to delete
    * Returns 0 on success, -ERR# otherwise.
    */
-  int delete_bucket(RGWBucketInfo& bucket_info, RGWObjVersionTracker& objv_tracker, bool check_empty = true);
+  int delete_bucket(RGWBucketInfo& bucket_info, RGWObjVersionTracker& objv_tracker, optional_yield y, bool check_empty = true);
 
   void wakeup_meta_sync_shards(set<int>& shard_ids);
   void wakeup_data_sync_shards(const string& source_zone, map<int, set<string> >& shard_ids);
@@ -2036,9 +2040,9 @@ public:
                         optional_yield y);
 
   int get_obj_state(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state,
-                    bool follow_olh, bool assume_noent = false);
-  int get_obj_state(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state) {
-    return get_obj_state(rctx, bucket_info, obj, state, true);
+                    bool follow_olh, optional_yield y, bool assume_noent = false);
+  int get_obj_state(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state, optional_yield y) {
+    return get_obj_state(rctx, bucket_info, obj, state, true, y);
   }
 
   using iterate_obj_cb = int (*)(const rgw_raw_obj&, off_t, off_t,
@@ -2046,7 +2050,8 @@ public:
 
   int iterate_obj(RGWObjectCtx& ctx, const RGWBucketInfo& bucket_info,
                   const rgw_obj& obj, off_t ofs, off_t end,
-                  uint64_t max_chunk_size, iterate_obj_cb cb, void *arg);
+                  uint64_t max_chunk_size, iterate_obj_cb cb, void *arg,
+                  optional_yield y);
 
   int flush_read_list(struct get_obj_data *d);
 
@@ -2062,7 +2067,7 @@ public:
 
   int raw_obj_stat(rgw_raw_obj& obj, uint64_t *psize, ceph::real_time *pmtime, uint64_t *epoch,
                    map<string, bufferlist> *attrs, bufferlist *first_chunk,
-                   RGWObjVersionTracker *objv_tracker);
+                   RGWObjVersionTracker *objv_tracker, optional_yield y);
 
   int obj_operate(const RGWBucketInfo& bucket_info, const rgw_obj& obj, librados::ObjectWriteOperation *op);
   int obj_operate(const RGWBucketInfo& bucket_info, const rgw_obj& obj, librados::ObjectReadOperation *op);
@@ -2097,11 +2102,11 @@ public:
   int update_olh(RGWObjectCtx& obj_ctx, RGWObjState *state, const RGWBucketInfo& bucket_info, const rgw_obj& obj, rgw_zone_set *zones_trace = nullptr);
   int set_olh(RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_info, const rgw_obj& target_obj, bool delete_marker, rgw_bucket_dir_entry_meta *meta,
               uint64_t olh_epoch, ceph::real_time unmod_since, bool high_precision_time,
-              rgw_zone_set *zones_trace = nullptr, bool log_data_change = false);
+              optional_yield y, rgw_zone_set *zones_trace = nullptr, bool log_data_change = false);
   int repair_olh(RGWObjState* state, const RGWBucketInfo& bucket_info,
                  const rgw_obj& obj);
   int unlink_obj_instance(RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_info, const rgw_obj& target_obj,
-                          uint64_t olh_epoch, rgw_zone_set *zones_trace = nullptr);
+                          uint64_t olh_epoch, optional_yield y, rgw_zone_set *zones_trace = nullptr);
 
   void check_pending_olh_entries(map<string, bufferlist>& pending_entries, map<string, bufferlist> *rm_pending_entries);
   int remove_olh_pending_entries(const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& olh_obj, map<string, bufferlist>& pending_attrs);
@@ -2216,6 +2221,7 @@ public:
                              map<string, rgw_bucket_dir_entry>& m,
                              bool *is_truncated,
                              rgw_obj_index_key *last_entry,
+                              optional_yield y,
                              bool (*force_check_filter)(const string& name) = nullptr);
   int cls_bucket_list_unordered(RGWBucketInfo& bucket_info, int shard_id,
                                const rgw_obj_index_key& start,
@@ -2223,6 +2229,7 @@ public:
                                uint32_t num_entries, bool list_versions,
                                vector<rgw_bucket_dir_entry>& ent_list,
                                bool *is_truncated, rgw_obj_index_key *last_entry,
+                                optional_yield y,
                                bool (*force_check_filter)(const string& name) = nullptr);
   int cls_bucket_head(const RGWBucketInfo& bucket_info, int shard_id, vector<rgw_bucket_dir_header>& headers, map<int, string> *bucket_instance_ids = NULL);
   int cls_bucket_head_async(const RGWBucketInfo& bucket_info, int shard_id, RGWGetDirHeader_CB *ctx, int *num_aio);
@@ -2308,7 +2315,7 @@ public:
   int list_gc_objs(int *index, string& marker, uint32_t max, bool expired_only, std::list<cls_rgw_gc_obj_info>& result, bool *truncated);
   int process_gc(bool expired_only);
   bool process_expire_objects();
-  int defer_gc(void *ctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj);
+  int defer_gc(void *ctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, optional_yield y);
 
   int process_lc();
   int list_lc_progress(const string& marker, uint32_t max_entries, map<string, int> *progress_map);
@@ -2324,7 +2331,7 @@ public:
                     librados::IoCtx& dst_ioctx,
                     const string& dst_oid, const string& dst_locator);
   int fix_head_obj_locator(const RGWBucketInfo& bucket_info, bool copy_obj, bool remove_bad, rgw_obj_key& key);
-  int fix_tail_obj_locator(const RGWBucketInfo& bucket_info, rgw_obj_key& key, bool fix, bool *need_fix);
+  int fix_tail_obj_locator(const RGWBucketInfo& bucket_info, rgw_obj_key& key, bool fix, bool *need_fix, optional_yield y);
 
   int cls_user_get_header(const string& user_id, cls_user_header *header);
   int cls_user_reset_stats(const string& user_id);
@@ -2431,7 +2438,8 @@ public:
                        const RGWBucketInfo& bucket_info,
                        rgw_bucket_dir_entry& list_state,
                        rgw_bucket_dir_entry& object,
-                       bufferlist& suggested_updates);
+                       bufferlist& suggested_updates,
+                       optional_yield y);
 
   /**
    * Init pool iteration
index 669550f1d5c421ea89f9387f0f5af3924ed7b4c5..b8a2c75502db43bb6d59a180d4378da999b83e58 100644 (file)
@@ -109,7 +109,7 @@ void RGWOp_Check_Bucket_Index::execute()
   op_state.set_fix_index(fix_index);
   op_state.set_check_objects(check_objects);
 
-  http_ret = RGWBucketAdminOp::check_index(store, op_state, flusher);
+  http_ret = RGWBucketAdminOp::check_index(store, op_state, flusher, s->yield);
 }
 
 class RGWOp_Bucket_Link : public RGWRESTOp {
@@ -205,7 +205,7 @@ void RGWOp_Bucket_Remove::execute()
   op_state.set_bucket_name(bucket);
   op_state.set_delete_children(delete_children);
 
-  http_ret = RGWBucketAdminOp::remove_bucket(store, op_state);
+  http_ret = RGWBucketAdminOp::remove_bucket(store, op_state, s->yield);
 }
 
 class RGWOp_Set_Bucket_Quota : public RGWRESTOp {
index bce2ca9457698f0c394b48799762129508b84328..2af5cfb558f579885902cb8caa7444146c5cda1d 100644 (file)
@@ -1920,7 +1920,7 @@ static inline int get_obj_attrs(RGWRados *store, struct req_state *s, rgw_obj& o
 
   read_op.params.attrs = &attrs;
 
-  return read_op.prepare();
+  return read_op.prepare(s->yield);
 }
 
 static inline void set_attr(map<string, bufferlist>& attrs, const char* key, const std::string& value)
@@ -4131,7 +4131,7 @@ bool RGWHandler_REST_S3Website::web_dir() const {
   obj_ctx.set_prefetch_data(obj);
 
   RGWObjState* state = nullptr;
-  if (store->get_obj_state(&obj_ctx, s->bucket_info, obj, &state, false) < 0) {
+  if (store->get_obj_state(&obj_ctx, s->bucket_info, obj, &state, false, s->yield) < 0) {
     return false;
   }
   if (! state->exists) {
index b3ad255c3dfbf4d6d10386ff7f7517c424c5fdad..ffe678a1be5957735b5c07b2c745312a8e415f9d 100644 (file)
@@ -881,7 +881,7 @@ int RGWPutObj_ObjStore_SWIFT::update_slo_segment_size(rgw_slo_entry& entry) {
   read_op.params.attrs = &attrs;
   read_op.params.obj_size = &size_bytes;
 
-  r = read_op.prepare();
+  r = read_op.prepare(s->yield);
   if (r < 0) {
     return r;
   }
@@ -2557,7 +2557,7 @@ bool RGWSwiftWebsiteHandler::is_web_dir() const
   obj_ctx.set_prefetch_data(obj);
 
   RGWObjState* state = nullptr;
-  if (store->get_obj_state(&obj_ctx, s->bucket_info, obj, &state, false) < 0) {
+  if (store->get_obj_state(&obj_ctx, s->bucket_info, obj, &state, false, s->yield) < 0) {
     return false;
   }
 
@@ -2587,7 +2587,7 @@ bool RGWSwiftWebsiteHandler::is_index_present(const std::string& index)
   obj_ctx.set_prefetch_data(obj);
 
   RGWObjState* state = nullptr;
-  if (store->get_obj_state(&obj_ctx, s->bucket_info, obj, &state, false) < 0) {
+  if (store->get_obj_state(&obj_ctx, s->bucket_info, obj, &state, false, s->yield) < 0) {
     return false;
   }
 
index eee50202a47b7e08f40803cf9618d7e36017eaee..b9df9806297bc4155e92d2c9c961334192325b88 100644 (file)
@@ -341,7 +341,7 @@ void RGWOp_User_Remove::execute()
 
   op_state.set_purge_data(purge_data);
 
-  http_ret = RGWUserAdminOp_User::remove(store, op_state, flusher);
+  http_ret = RGWUserAdminOp_User::remove(store, op_state, flusher, s->yield);
 }
 
 class RGWOp_Subuser_Create : public RGWRESTOp {
index d79e6cbe3c76dcabc31aba4e383a73285a27daa5..0f693cd137c494f5ebc6739889b9ae3336292fd1 100644 (file)
@@ -445,7 +445,7 @@ int RGWDataAccess::Object::put(bufferlist& data,
                                   owner.get_id(), obj_ctx, obj, olh_epoch,
                                   req_id, dpp, y);
 
-  int ret = processor.prepare();
+  int ret = processor.prepare(y);
   if (ret < 0)
     return ret;
 
index 6b26109ef310579ee98f61a9afaac31c13c70c58..e93ff9ca7ca4f7fd73a1778a14af77edf73fa894 100644 (file)
@@ -2083,7 +2083,7 @@ int RGWUser::add(RGWUserAdminOpState& op_state, std::string *err_msg)
   return 0;
 }
 
-int RGWUser::execute_remove(RGWUserAdminOpState& op_state, std::string *err_msg)
+int RGWUser::execute_remove(RGWUserAdminOpState& op_state, std::string *err_msg, optional_yield y)
 {
   int ret;
 
@@ -2117,7 +2117,7 @@ int RGWUser::execute_remove(RGWUserAdminOpState& op_state, std::string *err_msg)
 
     std::map<std::string, RGWBucketEnt>::iterator it;
     for (it = m.begin(); it != m.end(); ++it) {
-      ret = rgw_remove_bucket(store, ((*it).second).bucket, true);
+      ret = rgw_remove_bucket(store, ((*it).second).bucket, true, y);
       if (ret < 0) {
         set_err_msg(err_msg, "unable to delete user data");
         return ret;
@@ -2140,7 +2140,7 @@ int RGWUser::execute_remove(RGWUserAdminOpState& op_state, std::string *err_msg)
   return 0;
 }
 
-int RGWUser::remove(RGWUserAdminOpState& op_state, std::string *err_msg)
+int RGWUser::remove(RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg)
 {
   std::string subprocess_msg;
   int ret;
@@ -2151,7 +2151,7 @@ int RGWUser::remove(RGWUserAdminOpState& op_state, std::string *err_msg)
     return ret;
   }
 
-  ret = execute_remove(op_state, &subprocess_msg);
+  ret = execute_remove(op_state, &subprocess_msg, y);
   if (ret < 0) {
     set_err_msg(err_msg, "unable to remove user, " + subprocess_msg);
     return ret;
@@ -2537,7 +2537,7 @@ int RGWUserAdminOp_User::modify(RGWRados *store, RGWUserAdminOpState& op_state,
 }
 
 int RGWUserAdminOp_User::remove(RGWRados *store, RGWUserAdminOpState& op_state,
-                  RGWFormatterFlusher& flusher)
+                  RGWFormatterFlusher& flusher, optional_yield y)
 {
   RGWUserInfo info;
   RGWUser user;
@@ -2546,7 +2546,7 @@ int RGWUserAdminOp_User::remove(RGWRados *store, RGWUserAdminOpState& op_state,
     return ret;
 
 
-  ret = user.remove(op_state, NULL);
+  ret = user.remove(op_state, y, NULL);
 
   if (ret == -ENOENT)
     ret = -ERR_NO_SUCH_USER;
index 942648b514a996078ca012e2d86f6d0db29be62c..84a5f0b8dd29b17236c85c45175c15e3e98e0696 100644 (file)
@@ -670,7 +670,8 @@ private:
 
   /* API Contract Fulfillment */
   int execute_add(RGWUserAdminOpState& op_state, std::string *err_msg);
-  int execute_remove(RGWUserAdminOpState& op_state, std::string *err_msg);
+  int execute_remove(RGWUserAdminOpState& op_state, 
+                    std::string *err_msg, optional_yield y);
   int execute_modify(RGWUserAdminOpState& op_state, std::string *err_msg);
 
 public:
@@ -692,7 +693,7 @@ public:
 
   /* API Contracted Methods */
   int add(RGWUserAdminOpState& op_state, std::string *err_msg = NULL);
-  int remove(RGWUserAdminOpState& op_state, std::string *err_msg = NULL);
+  int remove(RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg = NULL);
 
   /* remove an already populated RGWUser */
   int remove(std::string *err_msg = NULL);
@@ -731,7 +732,7 @@ public:
                   RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher);
 
   static int remove(RGWRados *store,
-                  RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher);
+                  RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y);
 };
 
 class RGWUserAdminOp_Subuser