the `--bypass-gc` argument to `radosgw-admin bucket rm` causes us to
call `RadosBucket::remove_bypass_gc()`, which loops over the tail
objects and removes each with `RGWRados::delete_raw_obj_aio()`
however, this was removing the objects with `cls_rgw_remove_obj()`,
which is for head objects, not tails. tail objects must be removed with
`cls_refcount_put()`, which preserves them until the last copy is
removed
rename `delete_raw_obj_aio()` to `delete_tail_obj_aio()` to clarify its
purpose
Fixes: https://tracker.ceph.com/issues/73348
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit
1fba459071da9f7ec13defe2c666f0df8174c8da)
return &rados;
}
-int RGWRados::delete_raw_obj_aio(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj, list<librados::AioCompletion *>& handles)
+int RGWRados::delete_tail_obj_aio(const DoutPrefixProvider *dpp,
+ const rgw_raw_obj& obj,
+ const std::string& tag,
+ list<librados::AioCompletion *>& handles)
{
rgw_rados_ref ref;
int ret = get_raw_obj_ref(dpp, obj, &ref);
}
ObjectWriteOperation op;
- list<string> prefixes;
- cls_rgw_remove_obj(op, prefixes);
+ cls_refcount_put(op, tag, true);
AioCompletion *c = librados::Rados::aio_create_completion(nullptr, nullptr);
ret = ref.ioctx.aio_operate(ref.obj.oid, c, &op);
librados::Rados* get_rados_handle();
- int delete_raw_obj_aio(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj, std::list<librados::AioCompletion *>& handles);
+ int delete_tail_obj_aio(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj,
+ const std::string& tag, std::list<librados::AioCompletion *>& handles);
int delete_obj_aio(const DoutPrefixProvider *dpp, const rgw_obj& obj, RGWBucketInfo& info, RGWObjState *astate,
std::list<librados::AioCompletion *>& handles, bool keep_index_consistent,
optional_yield y);
rgw_raw_obj raw_head_obj;
store->get_raw_obj(manifest.get_head_placement_rule(), head_obj, &raw_head_obj);
+ // tag for cls_refcount
+ const std::string tag = (astate->tail_tag.length() > 0
+ ? astate->tail_tag.to_str()
+ : astate->obj_tag.to_str());
for (; miter != manifest.obj_end(dpp) && max_aio--; ++miter) {
if (!max_aio) {
ret = drain_aio(handles);
continue;
}
- ret = store->getRados()->delete_raw_obj_aio(dpp, last_obj, handles);
+ ret = store->getRados()->delete_tail_obj_aio(dpp, last_obj, tag, handles);
if (ret < 0) {
ldpp_dout(dpp, -1) << "ERROR: delete obj aio failed with " << ret << dendl;
return ret;