]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add OPT_BUCKET_SYNC_RUN to gc_ops_list, so that
authorPritha Srivastava <prsrivas@redhat.com>
Fri, 25 Feb 2022 11:00:46 +0000 (16:30 +0530)
committerCory Snyder <csnyder@iland.com>
Wed, 16 Mar 2022 14:22:56 +0000 (10:22 -0400)
gc is initialised and send_chain does not crash.

Also deleting objects inline in case gc is uninitialised.

Fixes: https://tracker.ceph.com/issues/54417
Signed-off-by: Pritha Srivastava <prsrivas@redhat.com>
(cherry picked from commit aa3006ea34e301148779f6055ee3fa045dabbf7e)

src/rgw/rgw_admin.cc
src/rgw/rgw_rados.cc

index 6d10387fb3598a8199bd70c4cff5c90de475d093..20ad6b9c84067e65cc6f108125ce227e9fbe053a 100644 (file)
@@ -4239,7 +4239,8 @@ int main(int argc, const char **argv)
                         OPT::USER_RM,    // --purge-data
                         OPT::OBJECTS_EXPIRE,
                         OPT::OBJECTS_EXPIRE_STALE_RM,
-                        OPT::LC_PROCESS
+                        OPT::LC_PROCESS,
+       OPT::BUCKET_SYNC_RUN
     };
 
     raw_storage_op = (raw_storage_ops_list.find(opt_cmd) != raw_storage_ops_list.end() ||
index 5fb9e9f3c48b55cae7aca35918aa15f646c953b7..70eb4b3c794b74673b7244c1c60f3cfc91341dd0 100644 (file)
@@ -4951,10 +4951,16 @@ int RGWRados::Object::complete_atomic_modification(const DoutPrefixProvider *dpp
   }
 
   string tag = (state->tail_tag.length() > 0 ? state->tail_tag.to_str() : state->obj_tag.to_str());
-  auto ret = store->gc->send_chain(chain, tag); // do it synchronously
-  if (ret < 0) {
-    //Delete objects inline if send chain to gc fails
+  if (store->gc == nullptr) {
+    ldpp_dout(dpp, 0) << "deleting objects inline since gc isn't initialized" << dendl;
+    //Delete objects inline just in case gc hasn't been initialised, prevents crashes
     store->delete_objs_inline(dpp, chain, tag);
+  } else {
+    auto ret = store->gc->send_chain(chain, tag); // do it synchronously
+    if (ret < 0) {
+      //Delete objects inline if send chain to gc fails
+      store->delete_objs_inline(dpp, chain, tag);
+    }
   }
   return 0;
 }