]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: check bucket shard init status in RGWRadosBILogTrimCR 44907/head
authorMykola Golub <mgolub@suse.com>
Wed, 2 Feb 2022 18:25:33 +0000 (18:25 +0000)
committerMykola Golub <mgolub@suse.com>
Wed, 15 Jun 2022 08:54:24 +0000 (11:54 +0300)
to avoid using not properly initialized bs.bucket_obj.

Fixes: https://tracker.ceph.com/issues/54119
Signed-off-by: Mykola Golub <mgolub@suse.com>
(cherry picked from commit 02c6a56f49571183cd599932b26ff90c2b4b7683)

src/rgw/rgw_cr_rados.cc
src/rgw/rgw_cr_rados.h

index 70975c22a4ee1166ec8beeba2e11358d26c90bb5..1174a3fc33b751329e8a1bf6800c86dd643e8629 100644 (file)
@@ -603,15 +603,21 @@ RGWRadosBILogTrimCR::RGWRadosBILogTrimCR(const DoutPrefixProvider *dpp,
                                          int shard_id,
                                          const std::string& start_marker,
                                          const std::string& end_marker)
-  : RGWSimpleCoroutine(store->ctx()), bs(store->getRados()),
+  : RGWSimpleCoroutine(store->ctx()), bucket_info(bucket_info),
+    shard_id(shard_id), bs(store->getRados()),
     start_marker(BucketIndexShardsManager::get_shard_marker(start_marker)),
     end_marker(BucketIndexShardsManager::get_shard_marker(end_marker))
 {
-  bs.init(dpp, bucket_info, bucket_info.layout.current_index, shard_id);
 }
 
 int RGWRadosBILogTrimCR::send_request(const DoutPrefixProvider *dpp)
 {
+  int r = bs.init(dpp, bucket_info, bucket_info.layout.current_index, shard_id);
+  if (r < 0) {
+    ldpp_dout(dpp, -1) << "ERROR: bucket shard init failed ret=" << r << dendl;
+    return r;
+  }
+
   bufferlist in;
   cls_rgw_bi_log_trim_op call;
   call.start_marker = std::move(start_marker);
index 87fa65b5514a17ff4824435ffaa6a53e16879113..c46c0394fefeb52f563a3c8c1aab89cdbe8e6c7a 100644 (file)
@@ -910,6 +910,8 @@ public:
 };
 
 class RGWRadosBILogTrimCR : public RGWSimpleCoroutine {
+  const RGWBucketInfo& bucket_info;
+  int shard_id;
   RGWRados::BucketShard bs;
   std::string start_marker;
   std::string end_marker;