From a6d65bb0a9688f82902d20d28381c3d911bc4447 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Thu, 16 Oct 2014 14:26:37 -0700 Subject: [PATCH] cls_rgw: update olh log when unlinking entry Need to update log so that later client will be able to appropriately remove the object. Signed-off-by: Yehuda Sadeh --- src/cls/rgw/cls_rgw.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/cls/rgw/cls_rgw.cc b/src/cls/rgw/cls_rgw.cc index e6ff801e66acb..b31845a1bf555 100644 --- a/src/cls/rgw/cls_rgw.cc +++ b/src/cls/rgw/cls_rgw.cc @@ -952,7 +952,6 @@ static int read_key_list_entry(cls_method_context_t hctx, cls_rgw_obj_key& key, int ret = read_index_entry(hctx, *idx, entry); if (ret < 0) { - CLS_LOG(0, "ERROR: read_index_entry() reading previous instance %s ret=%d", idx->c_str(), ret); return ret; } @@ -1209,8 +1208,16 @@ static int rgw_bucket_link_olh(cls_method_context_t hctx, bufferlist *in, buffer ret = read_key_list_entry(hctx, no_instance_key, &plain_entry, &plain_idx); if (ret >= 0) { -#warning handle overwrite of non-olh object, need to update log +#warning handle overwrite of non-olh object, need to update stats ret = cls_cxx_map_remove_key(hctx, plain_idx); + if (ret < 0) { + CLS_LOG(0, "ERROR: cls_Cxx_map_remove_key() ret=%d", ret); + return ret; + } + + if (!plain_entry.is_delete_marker()) { + olh.update_log(CLS_RGW_OLH_OP_REMOVE_INSTANCE, op.op_tag, plain_entry.key, false); + } } } -- 2.39.5