From 123f508a8069b6c9f5d3871d77385b4d2edc8114 Mon Sep 17 00:00:00 2001 From: Pritha Srivastava Date: Tue, 7 Dec 2021 16:31:25 +0530 Subject: [PATCH] rgw: deleting objects inline in case bypass_gc is specified for bucket remove command. fixes: https://tracker.ceph.com/issues/53512 Signed-off-by: Pritha Srivastava --- src/rgw/rgw_rados.h | 4 ++++ src/rgw/rgw_sal_rados.cc | 21 +++++++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index e59e0460e9951..44e7b953bf17b 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -482,6 +482,10 @@ public: return lc; } + RGWGC *get_gc() { + return gc; + } + RGWRados& set_run_gc_thread(bool _use_gc_thread) { use_gc_thread = _use_gc_thread; return *this; diff --git a/src/rgw/rgw_sal_rados.cc b/src/rgw/rgw_sal_rados.cc index 7c42b52472840..76b2399825da7 100644 --- a/src/rgw/rgw_sal_rados.cc +++ b/src/rgw/rgw_sal_rados.cc @@ -1985,15 +1985,20 @@ int RadosMultipartUpload::abort(const DoutPrefixProvider *dpp, CephContext *cct, } } while (truncated); - /* use upload id as tag and do it synchronously */ - ret = store->getRados()->send_chain_to_gc(chain, mp_obj.get_upload_id()); - if (ret < 0) { - ldpp_dout(dpp, 5) << __func__ << ": gc->send_chain() returned " << ret << dendl; - if (ret == -ENOENT) { - return -ERR_NO_SUCH_UPLOAD; - } - //Delete objects inline if send chain to gc fails + if (store->getRados()->get_gc() == nullptr) { + //Delete objects inline if gc hasn't been initialised (in case when bypass gc is specified) store->getRados()->delete_objs_inline(dpp, chain, mp_obj.get_upload_id()); + } else { + /* use upload id as tag and do it synchronously */ + ret = store->getRados()->send_chain_to_gc(chain, mp_obj.get_upload_id()); + if (ret < 0) { + ldpp_dout(dpp, 5) << __func__ << ": gc->send_chain() returned " << ret << dendl; + if (ret == -ENOENT) { + return -ERR_NO_SUCH_UPLOAD; + } + //Delete objects inline if send chain to gc fails + store->getRados()->delete_objs_inline(dpp, chain, mp_obj.get_upload_id()); + } } std::unique_ptr del_op = meta_obj->get_delete_op(obj_ctx); -- 2.39.5