From: Pritha Srivastava Date: Fri, 25 Feb 2022 11:00:46 +0000 (+0530) Subject: rgw: add OPT_BUCKET_SYNC_RUN to gc_ops_list, so that X-Git-Tag: v18.0.0~1329^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=aa3006ea34e301148779f6055ee3fa045dabbf7e;p=ceph.git rgw: add OPT_BUCKET_SYNC_RUN to gc_ops_list, so that 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 --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 9b252b73e386d..3355a6972ce29 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -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() || diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index cfd28351d60f2..f992532fe3874 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -4952,10 +4952,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; }