]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cls_rgw: remove instance entry when removing delete marker
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 31 Oct 2014 00:15:26 +0000 (17:15 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Mon, 19 Jan 2015 23:57:50 +0000 (15:57 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/cls/rgw/cls_rgw.cc

index 7efcff4adea2c9d7af6690a061d093680c710a2e..090976b99277ea3dfa1b85264295e667cb6f0e8d 100644 (file)
@@ -1096,6 +1096,17 @@ public:
     return 0;
   }
 
+  int unlink_instance_entry() {
+    /* this instance has a previous list entry, remove that entry */
+    CLS_LOG(20, "unlink_instance_entry() instance_idx=%s", escape_str(instance_idx).c_str());
+    int ret = cls_cxx_map_remove_key(hctx, instance_idx);
+    if (ret < 0) {
+      CLS_LOG(0, "ERROR: cls_cxx_map_remove_key() instance_idx=%s ret=%d", instance_idx.c_str(), ret);
+      return ret;
+    }
+    return 0;
+  }
+
   int write_entries(uint64_t flags_set, uint64_t flags_reset) {
     if (!initialized) {
       int ret = init();
@@ -1466,6 +1477,11 @@ static int rgw_bucket_unlink_instance(cls_method_context_t hctx, bufferlist *in,
 
   if (!obj.is_delete_marker()) {
     olh.update_log(CLS_RGW_OLH_OP_REMOVE_INSTANCE, op.op_tag, op.key, false);
+  } else {
+    ret = obj.unlink_instance_entry();
+    if (ret < 0) {
+      return ret;
+    }
   }
 
   ret = obj.unlink_list_entry();