]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: check bucket shard init status in RGWRadosBILogTrimCR 44892/head
authorMykola Golub <mgolub@suse.com>
Wed, 2 Feb 2022 18:25:33 +0000 (18:25 +0000)
committerMykola Golub <mgolub@suse.com>
Thu, 3 Feb 2022 08:16:20 +0000 (08:16 +0000)
to avoid using not properly initialized bs.bucket_obj.

Fixes: https://tracker.ceph.com/issues/54119
Signed-off-by: Mykola Golub <mgolub@suse.com>
src/rgw/rgw_cr_rados.cc
src/rgw/rgw_cr_rados.h

index 2a3d26e0a30ea1c8533ee334baa523075bf7880f..7af1f5a7fec2dbc67370e8db1550dd998ccf9625 100644 (file)
@@ -605,15 +605,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 cb9d0f09408f5744e598eccf5ecee493fac4fc47..23ee4a6a9d08f279b5ce2a22210caff252cad5ec 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;