]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
src/rgw: Additional changes based on comments 50206/head
authorKalpesh Pandya <kapandya@redhat.com>
Thu, 23 Feb 2023 11:09:25 +0000 (16:39 +0530)
committerKalpesh Pandya <kapandya@redhat.com>
Mon, 19 Jun 2023 21:48:30 +0000 (03:18 +0530)
Signed-off-by: Kalpesh Pandya <kapandya@redhat.com>
14 files changed:
src/rgw/driver/rados/rgw_bucket.cc
src/rgw/driver/rados/rgw_bucket.h
src/rgw/driver/rados/rgw_gc.cc
src/rgw/driver/rados/rgw_notify.cc
src/rgw/driver/rados/rgw_object_expirer_core.cc
src/rgw/driver/rados/rgw_putobj_processor.cc
src/rgw/driver/rados/rgw_rados.cc
src/rgw/driver/rados/rgw_sal_rados.cc
src/rgw/rgw_admin.cc
src/rgw/rgw_crypt.cc
src/rgw/rgw_op.cc
src/test/rgw/rgw_cr_test.cc
src/test/rgw/test_d4n_filter.cc
src/test/rgw/test_rgw_lua.cc

index f5f0ee177f191f17d7fc0c0ef745f24436d2df9e..b1dd9fe1cdadb14ad70ec17890821cef2edda08e 100644 (file)
@@ -1333,16 +1333,16 @@ int RGWBucketAdminOp::clear_stale_instances(rgw::sal::Driver* driver,
                                             RGWFormatterFlusher& flusher,
                                             const DoutPrefixProvider *dpp, optional_yield y)
 {
-  auto process_f = [dpp](const bucket_instance_ls& lst,
+  auto process_f = [dpp, y](const bucket_instance_ls& lst,
                       Formatter *formatter,
                       rgw::sal::Driver* driver){
                      for (const auto &binfo: lst) {
                       std::unique_ptr<rgw::sal::Bucket> bucket;
                       driver->get_bucket(nullptr, binfo, &bucket);
-                      int ret = bucket->purge_instance(dpp, null_yield);
+                      int ret = bucket->purge_instance(dpp, y);
                        if (ret == 0){
                          auto md_key = "bucket.instance:" + binfo.bucket.get_key();
-                         ret = driver->meta_remove(dpp, md_key, null_yield);
+                         ret = driver->meta_remove(dpp, md_key, y);
                        }
                        formatter->open_object_section("delete_status");
                        formatter->dump_string("bucket_instance", binfo.bucket.get_key());
@@ -1386,16 +1386,16 @@ static void process_single_lc_entry(rgw::sal::Driver* driver,
                                    Formatter *formatter,
                                     const std::string& tenant_name,
                                     const std::string& bucket_name,
-                                    const DoutPrefixProvider *dpp)
+                                    const DoutPrefixProvider *dpp, optional_yield y)
 {
-  int ret = fix_single_bucket_lc(driver, tenant_name, bucket_name, dpp, null_yield);
+  int ret = fix_single_bucket_lc(driver, tenant_name, bucket_name, dpp, y);
   format_lc_status(formatter, tenant_name, bucket_name, -ret);
 }
 
 int RGWBucketAdminOp::fix_lc_shards(rgw::sal::Driver* driver,
                                     RGWBucketAdminOpState& op_state,
                                     RGWFormatterFlusher& flusher,
-                                    const DoutPrefixProvider *dpp)
+                                    const DoutPrefixProvider *dpp, optional_yield y)
 {
   std::string marker;
   void *handle;
@@ -1406,7 +1406,7 @@ int RGWBucketAdminOp::fix_lc_shards(rgw::sal::Driver* driver,
   if (const std::string& bucket_name = op_state.get_bucket_name();
       ! bucket_name.empty()) {
     const rgw_user user_id = op_state.get_user_id();
-    process_single_lc_entry(driver, formatter, user_id.tenant, bucket_name, dpp);
+    process_single_lc_entry(driver, formatter, user_id.tenant, bucket_name, dpp, y);
     formatter->flush(cout);
   } else {
     int ret = driver->meta_list_keys_init(dpp, "bucket", marker, &handle);
@@ -1431,7 +1431,7 @@ int RGWBucketAdminOp::fix_lc_shards(rgw::sal::Driver* driver,
         } if (ret != -ENOENT) {
           for (const auto &key:keys) {
             auto [tenant_name, bucket_name] = split_tenant(key);
-            process_single_lc_entry(driver, formatter, tenant_name, bucket_name, dpp);
+            process_single_lc_entry(driver, formatter, tenant_name, bucket_name, dpp, y);
           }
         }
         formatter->flush(cout); // regularly flush every 1k entries
index ce968275e6b77938b381b98874c811e5b9a7073f..7fffdb788e817621ec0ba2e7cb10a0369e2ad032 100644 (file)
@@ -386,7 +386,7 @@ public:
   static int clear_stale_instances(rgw::sal::Driver* driver, RGWBucketAdminOpState& op_state,
                                   RGWFormatterFlusher& flusher, const DoutPrefixProvider *dpp, optional_yield y);
   static int fix_lc_shards(rgw::sal::Driver* driver, RGWBucketAdminOpState& op_state,
-                           RGWFormatterFlusher& flusher, const DoutPrefixProvider *dpp);
+                           RGWFormatterFlusher& flusher, const DoutPrefixProvider *dpp, optional_yield y);
   static int fix_obj_expiry(rgw::sal::Driver* driver, RGWBucketAdminOpState& op_state,
                            RGWFormatterFlusher& flusher, const DoutPrefixProvider *dpp, optional_yield y, bool dry_run = false);
 
index 321f2c4f07cc572a9eec724df84a4b09d5af4e6a..4705c46fff4b29947475d2391090233589a084db 100644 (file)
@@ -51,7 +51,7 @@ void RGWGC::initialize(CephContext *_cct, RGWRados *_store, optional_yield y) {
     op.create(false);
     const uint64_t queue_size = cct->_conf->rgw_gc_max_queue_size, num_deferred_entries = cct->_conf->rgw_gc_max_deferred;
     gc_log_init2(op, queue_size, num_deferred_entries);
-    store->gc_operate(this, obj_names[i], &op, null_yield);
+    store->gc_operate(this, obj_names[i], &op, y);
   }
 }
 
@@ -88,7 +88,7 @@ std::tuple<int, std::optional<cls_rgw_obj_chain>> RGWGC::send_split_chain(const
         broken_chain.objs.pop_back();
         --it;
         ldpp_dout(this, 20) << "RGWGC::send_split_chain - more than, dont add to broken chain and send chain" << dendl;
-        auto ret = send_chain(broken_chain, tag, null_yield);
+        auto ret = send_chain(broken_chain, tag, y);
         if (ret < 0) {
           broken_chain.objs.insert(broken_chain.objs.end(), it, chain.objs.end()); // add all the remainder objs to the list to be deleted inline
           ldpp_dout(this, 0) << "RGWGC::send_split_chain - send chain returned error: " << ret << dendl;
@@ -99,14 +99,14 @@ std::tuple<int, std::optional<cls_rgw_obj_chain>> RGWGC::send_split_chain(const
     }
     if (!broken_chain.objs.empty()) { //when the chain is smaller than or equal to rgw_max_chunk_size
       ldpp_dout(this, 20) << "RGWGC::send_split_chain - sending leftover objects" << dendl;
-      auto ret = send_chain(broken_chain, tag, null_yield);
+      auto ret = send_chain(broken_chain, tag, y);
       if (ret < 0) {
         ldpp_dout(this, 0) << "RGWGC::send_split_chain - send chain returned error: " << ret << dendl;
         return {ret, {broken_chain}};
       }
     }
   } else {
-    auto ret = send_chain(chain, tag, null_yield);
+    auto ret = send_chain(chain, tag, y);
     if (ret < 0) {
       ldpp_dout(this, 0) << "RGWGC::send_split_chain - send chain returned error: " << ret << dendl;
       return {ret, {std::move(chain)}};
@@ -127,13 +127,13 @@ int RGWGC::send_chain(const cls_rgw_obj_chain& chain, const string& tag, optiona
 
   ldpp_dout(this, 20) << "RGWGC::send_chain - on object name: " << obj_names[i] << "tag is: " << tag << dendl;
 
-  auto ret = store->gc_operate(this, obj_names[i], &op, null_yield);
+  auto ret = store->gc_operate(this, obj_names[i], &op, y);
   if (ret != -ECANCELED && ret != -EPERM) {
     return ret;
   }
   ObjectWriteOperation set_entry_op;
   cls_rgw_gc_set_entry(set_entry_op, cct->_conf->rgw_gc_obj_min_wait, info);
-  return store->gc_operate(this, obj_names[i], &set_entry_op, null_yield);
+  return store->gc_operate(this, obj_names[i], &set_entry_op, y);
 }
 
 struct defer_chain_state {
@@ -240,7 +240,7 @@ int RGWGC::remove(int index, int num_entries, optional_yield y)
   ObjectWriteOperation op;
   cls_rgw_gc_queue_remove_entries(op, num_entries);
 
-  return store->gc_operate(this, obj_names[index], &op, null_yield);
+  return store->gc_operate(this, obj_names[index], &op, y);
 }
 
 int RGWGC::list(int *index, string& marker, uint32_t max, bool expired_only, std::list<cls_rgw_gc_obj_info>& result, bool *truncated, bool& processing_queue)
@@ -733,7 +733,7 @@ int RGWGC::process(bool expired_only, optional_yield y)
 
   for (int i = 0; i < max_objs; i++) {
     int index = (i + start) % max_objs;
-    int ret = process(index, max_secs, expired_only, io_manager, null_yield);
+    int ret = process(index, max_secs, expired_only, io_manager, y);
     if (ret < 0)
       return ret;
   }
index 8116945479c1a7b3ea10d6e33bcbdf40c4313db6..b1835016ec0eef21b9adc01ace1e43c67f74fc50 100644 (file)
@@ -792,7 +792,7 @@ static inline bool notification_match(reservation_t& res,
   const RGWPubSub ps(res.store, res.user_tenant);
   const RGWPubSub::Bucket ps_bucket(ps, res.bucket);
   rgw_pubsub_bucket_topics bucket_topics;
-  auto rc = ps_bucket.get_topics(res.dpp, bucket_topics, res.s->yield);
+  auto rc = ps_bucket.get_topics(res.dpp, bucket_topics, res.yield);
   if (rc < 0) {
     // failed to fetch bucket topics
     return rc;
index 0df1553beef9dea9e02006ce368bcf2ecca85c7b..2c931cf909d5cc270c3c092e85ac5f3299719308 100644 (file)
@@ -188,7 +188,7 @@ int RGWObjExpStore::objexp_hint_trim(const DoutPrefixProvider *dpp,
   }
   auto& ref = obj.get_ref();
   int ret = cls_timeindex_trim_repeat(dpp, ref, oid, utime_t(start_time), utime_t(end_time),
-          from_marker, to_marker, null_yield);
+          from_marker, to_marker, y);
   if ((ret < 0 ) && (ret != -ENOENT)) {
     return ret;
   }
@@ -273,7 +273,7 @@ void RGWObjectExpirer::trim_chunk(const DoutPrefixProvider *dpp,
   real_time rt_to = to.to_real_time();
 
   int ret = exp_store.objexp_hint_trim(dpp, shard, rt_from, rt_to,
-                                       from_marker, to_marker, null_yield);
+                                       from_marker, to_marker, y);
   if (ret < 0) {
     ldpp_dout(dpp, 0) << "ERROR during trim: " << ret << dendl;
   }
@@ -327,7 +327,7 @@ bool RGWObjectExpirer::process_single_shard(const DoutPrefixProvider *dpp,
     garbage_chunk(dpp, entries, need_trim);
 
     if (need_trim) {
-      trim_chunk(dpp, shard, last_run, round_start, marker, out_marker, null_yield);
+      trim_chunk(dpp, shard, last_run, round_start, marker, out_marker, y);
     }
 
     utime_t now = ceph_clock_now();
@@ -358,7 +358,7 @@ bool RGWObjectExpirer::inspect_all_shards(const DoutPrefixProvider *dpp,
 
     ldpp_dout(dpp, 20) << "processing shard = " << shard << dendl;
 
-    if (! process_single_shard(dpp, shard, last_run, round_start, null_yield)) {
+    if (! process_single_shard(dpp, shard, last_run, round_start, y)) {
       all_done = false;
     }
   }
index 01e5ae6fdf3bddb94493eaed6a5539d2fec54091..9eb2ef2666835d3b5c22f4c83c6ea4e841e04e93 100644 (file)
@@ -203,7 +203,7 @@ RadosWriter::~RadosWriter()
       continue;
     }
 
-    int r = store->delete_raw_obj(dpp, obj, null_yield);
+    int r = store->delete_raw_obj(dpp, obj, y);
     if (r < 0 && r != -ENOENT) {
       ldpp_dout(dpp, 0) << "WARNING: failed to remove obj (" << obj << "), leaked" << dendl;
     }
@@ -212,7 +212,7 @@ RadosWriter::~RadosWriter()
   if (need_to_remove_head) {
     std::string version_id;
     ldpp_dout(dpp, 5) << "NOTE: we are going to process the head obj (" << *raw_head << ")" << dendl;
-    int r = store->delete_obj(dpp, obj_ctx, bucket_info, head_obj, 0, 0);
+    int r = store->delete_obj(dpp, obj_ctx, bucket_info, head_obj, 0, y, 0);
     if (r < 0 && r != -ENOENT) {
       ldpp_dout(dpp, 0) << "WARNING: failed to remove obj (" << *raw_head << "), leaked" << dendl;
     }
index 0c930581189b23b5ac7e984e639e5ae5a617e8a5..b6c76831a20d3dad983ede9574e302ae1312345f 100644 (file)
@@ -3993,7 +3993,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
 
   if (copy_if_newer) {
     /* need to get mtime for destination */
-    ret = get_obj_state(dpp, &obj_ctx, dest_bucket_info, stat_dest_obj, &dest_state, &manifest, y, stat_follow_olh, null_yield);
+    ret = get_obj_state(dpp, &obj_ctx, dest_bucket_info, stat_dest_obj, &dest_state, &manifest, stat_follow_olh, y);
     if (ret < 0)
       goto set_err_state;
 
@@ -4182,7 +4182,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
     if (copy_if_newer && canceled) {
       ldpp_dout(dpp, 20) << "raced with another write of obj: " << dest_obj << dendl;
       obj_ctx.invalidate(dest_obj); /* object was overwritten */
-      ret = get_obj_state(dpp, &obj_ctx, dest_bucket_info, stat_dest_obj, &dest_state, &manifest, y, stat_follow_olh, null_yield);
+      ret = get_obj_state(dpp, &obj_ctx, dest_bucket_info, stat_dest_obj, &dest_state, &manifest, stat_follow_olh, y);
       if (ret < 0) {
         ldpp_dout(dpp, 0) << "ERROR: " << __func__ << ": get_err_state() returned ret=" << ret << dendl;
         goto set_err_state;
index f9f0886b199b8e18b605a674ec10f4892935f3ae..e1d2f72369af5c5a78d214208e1f43fd4180fcad 100644 (file)
@@ -2420,7 +2420,7 @@ int RadosMultipartUpload::cleanup_part_history(const DoutPrefixProvider* dpp,
     store->getRados()->delete_objs_inline(dpp, chain, mp_obj.get_upload_id());
   } else {
     // use upload id as tag and do it synchronously
-    auto [ret, leftover_chain] = store->getRados()->send_chain_to_gc(chain, mp_obj.get_upload_id());
+    auto [ret, leftover_chain] = store->getRados()->send_chain_to_gc(chain, mp_obj.get_upload_id(), y);
     if (ret < 0 && leftover_chain) {
       ldpp_dout(dpp, 5) << __func__ << ": gc->send_chain() returned " << ret << dendl;
       if (ret == -ENOENT) {
index cab4e1c6282f98f303f8956a1652842836976b2b..96742ad20ba347379e750985f16a5b76353d362c 100644 (file)
@@ -8368,7 +8368,7 @@ next:
     }
     RGWRados* store = rados_store->getRados();
 
-    int ret = store->process_gc(!include_all);
+    int ret = store->process_gc(!include_all, null_yield);
     if (ret < 0) {
       cerr << "ERROR: gc processing returned error: " << cpp_strerror(-ret) << std::endl;
       return 1;
@@ -8465,7 +8465,7 @@ next:
   }
 
   if (opt_cmd == OPT::LC_RESHARD_FIX) {
-    ret = RGWBucketAdminOp::fix_lc_shards(driver, bucket_op, stream_flusher, dpp());
+    ret = RGWBucketAdminOp::fix_lc_shards(driver, bucket_op, stream_flusher, dpp(), null_yield);
     if (ret < 0) {
       cerr << "ERROR: fixing lc shards: " << cpp_strerror(-ret) << std::endl;
     }
index 18b23575655a432d39e5c4dc4448ea8968dd23f8..d2c3edb0d55a9f1fee08a8653f27e3c545e45114 100644 (file)
@@ -1004,7 +1004,7 @@ static int get_sse_s3_bucket_key(req_state *s,
       if (res != -ECANCELED) {
         break;
       }
-      res = s->bucket->try_refresh_info(s, nullptr, null_yield);
+      res = s->bucket->try_refresh_info(s, nullptr, s->yield);
       if (res != 0) {
         break;
       }
index 5e4ba6f3c6e3759809cb03b936322964828611a8..4114dc85284434d57495a1652e34fcbe7917e33f 100644 (file)
@@ -1303,7 +1303,7 @@ void RGWPutBucketReplication::execute(optional_yield y) {
     return;
   }
 
-  op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this] {
+  op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this, y] {
     auto sync_policy = (s->bucket->get_info().sync_policy ? *s->bucket->get_info().sync_policy : rgw_sync_policy_info());
 
     for (auto& group : sync_policy_groups) {
@@ -1312,7 +1312,7 @@ void RGWPutBucketReplication::execute(optional_yield y) {
 
     s->bucket->get_info().set_sync_policy(std::move(sync_policy));
 
-    int ret = s->bucket->put_info(this, false, real_time(), null_yield);
+    int ret = s->bucket->put_info(this, false, real_time(), y);
     if (ret < 0) {
       ldpp_dout(this, 0) << "ERROR: put_bucket_instance_info (bucket=" << s->bucket << ") returned ret=" << ret << dendl;
       return ret;
@@ -1345,7 +1345,7 @@ void RGWDeleteBucketReplication::execute(optional_yield y)
     return;
   }
 
-  op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this] {
+  op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this, y] {
     if (!s->bucket->get_info().sync_policy) {
       return 0;
     }
@@ -1356,7 +1356,7 @@ void RGWDeleteBucketReplication::execute(optional_yield y)
 
     s->bucket->get_info().set_sync_policy(std::move(sync_policy));
 
-    int ret = s->bucket->put_info(this, false, real_time(), null_yield);
+    int ret = s->bucket->put_info(this, false, real_time(), y);
     if (ret < 0) {
       ldpp_dout(this, 0) << "ERROR: put_bucket_instance_info (bucket=" << s->bucket << ") returned ret=" << ret << dendl;
       return ret;
@@ -2880,10 +2880,10 @@ void RGWSetBucketWebsite::execute(optional_yield y)
     return;
   }
 
-  op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this] {
+  op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this, y] {
       s->bucket->get_info().has_website = true;
       s->bucket->get_info().website_conf = website_conf;
-      op_ret = s->bucket->put_info(this, false, real_time(), null_yield);
+      op_ret = s->bucket->put_info(this, false, real_time(), y);
       return op_ret;
     }, y);
 
@@ -2923,10 +2923,10 @@ void RGWDeleteBucketWebsite::execute(optional_yield y)
       << "returned err=" << op_ret << dendl;
     return;
   }
-  op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this] {
+  op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this, y] {
       s->bucket->get_info().has_website = false;
       s->bucket->get_info().website_conf = RGWBucketWebsiteConf();
-      op_ret = s->bucket->put_info(this, false, real_time(), null_yield);
+      op_ret = s->bucket->put_info(this, false, real_time(), y);
       return op_ret;
     }, y);
   if (op_ret < 0) {
@@ -8400,9 +8400,9 @@ void RGWPutBucketObjectLock::execute(optional_yield y)
     return;
   }
 
-  op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this] {
+  op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this, y] {
     s->bucket->get_info().obj_lock = obj_lock;
-    op_ret = s->bucket->put_info(this, false, real_time(), null_yield);
+    op_ret = s->bucket->put_info(this, false, real_time(), y);
     return op_ret;
   }, y);
   return;
index 6535a300f141afa4000e1c28c7c80b474aa8bda4..37120925291a30df0609043c706e2a9177743396 100644 (file)
@@ -328,8 +328,8 @@ int main(int argc, const char **argv)
                              false,
                              false,
                              false,
-                             false, null_yield,
-                             true,
+                             false,
+                             true, null_yield, 
                              false));
   if (!store) {
     std::cerr << "couldn't init storage provider" << std::endl;
index d62c85f245b2551c80038e11fd6e92e7ba169c17..b4d37bc698df9df3418b9efa1483fb6b65497794 100644 (file)
@@ -65,7 +65,7 @@ class Environment : public ::testing::Environment {
               false,
               false,
               false,
-              false,
+              false, null_yield,
              false); 
     
       ASSERT_NE(driver, nullptr);
index a539c025b50778d41565a40d97ef1283323d58ab..00b252e5d85324e626064db9c033d6e1fa43701d 100644 (file)
@@ -102,7 +102,7 @@ public:
     return 0;
   }
 
-  virtual int trim_usage(const DoutPrefixProvider *dpp, uint64_t start_epoch, uint64_t end_epoch) override {
+  virtual int trim_usage(const DoutPrefixProvider *dpp, uint64_t start_epoch, uint64_t end_epoch, optional_yield y) override {
     return 0;
   }