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: v16.2.8~108^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8a8d2c42f57dbe1586ed7cae942ff379d3db09ae;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 (cherry picked from commit aa3006ea34e301148779f6055ee3fa045dabbf7e) Conflicts: src/rgw/rgw_admin.cc Cherry-pick notes: - Conflicts due to differences in ops lists --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 7928867648e..4af87a1d5d8 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -3909,7 +3909,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, }; bool 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 b9f3e08f59e..2da936ae425 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -4796,10 +4796,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; }