From f1f9a5f911301851e5c3460bfeca424b10311f51 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Mon, 22 Dec 2014 15:50:42 -0800 Subject: [PATCH] rgw: delete obj, handle null instance in all paths When passing rgw_obj structures to the bucket index, we should remove the "null" instance, pass an empty instance instead. Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_rados.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index a0acbeef2b92c..4b88769ad9851 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -4001,11 +4001,17 @@ void RGWRados::cls_obj_check_prefix_exist(ObjectOperation& op, const string& pre int RGWRados::Object::Delete::delete_obj() { RGWRados *store = target->get_store(); - rgw_obj& obj = target->get_obj(); + rgw_obj& src_obj = target->get_obj(); + const string& instance = src_obj.get_instance(); + rgw_obj obj = src_obj; + + if (instance == "null") { + obj.clear_instance(); + } + bool explicit_marker_version = (params.olh_epoch > 0 || !params.marker_version_id.empty()); if (params.versioning_status & BUCKET_VERSIONED || explicit_marker_version) { - const string& instance = obj.get_instance(); if (instance.empty() || explicit_marker_version) { rgw_obj marker = obj; @@ -4029,8 +4035,8 @@ int RGWRados::Object::Delete::delete_obj() return r; } } else { - rgw_bucket_dir_entry dirent; + int r = store->bi_get_instance(obj, &dirent); if (r < 0) { return r; @@ -4046,10 +4052,6 @@ int RGWRados::Object::Delete::delete_obj() return 0; } - if (obj.get_instance() == "null") { - obj.clear_instance(); - } - rgw_rados_ref ref; rgw_bucket bucket; int r = store->get_obj_ref(obj, &ref, &bucket); -- 2.39.5