]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: revert PR #41897 to allow multiple delete markers to be created
authorJane Zhu <jzhu116@bloomberg.net>
Tue, 19 Dec 2023 03:37:44 +0000 (22:37 -0500)
committerJane Zhu <jzhu116@bloomberg.net>
Thu, 23 Jan 2025 22:15:38 +0000 (22:15 +0000)
Signed-off-by: Juan Zhu <jzhu4@dev-10-34-20-139.pw1.bcc.bloomberg.com>
src/cls/rgw/cls_rgw.cc

index 2b73fb3b7aa700b11b91296fefb4d59a3001a650..aa47be003005c1d8f542d3e673ae7026c192fa49 100644 (file)
@@ -1811,28 +1811,6 @@ static int rgw_bucket_link_olh(cls_method_context_t hctx, bufferlist *in, buffer
     return ret;
   }
 
-  BIOLHEntry olh(hctx, op.key);
-  bool olh_read_attempt = false;
-  bool olh_found = false;
-  if (!existed && op.delete_marker) {
-    /* read olh */
-    ret = olh.init(&olh_found);
-    if (ret < 0) {
-      return ret;
-    }
-    olh_read_attempt = true;
-
-    // if we're deleting (i.e., adding a delete marker, and the OLH
-    // indicates it already refers to a delete marker, error out)
-    if (olh_found && olh.get_entry().delete_marker) {
-      CLS_LOG(10,
-             "%s: delete marker received for \"%s\" although OLH"
-             " already refers to a delete marker",
-             __func__, escape_str(op.key.to_string()).c_str());
-      return -ENOENT;
-    }
-  }
-
   if (existed && !real_clock::is_zero(op.unmod_since)) {
     timespec mtime = ceph::real_clock::to_timespec(obj.mtime());
     timespec unmod = ceph::real_clock::to_timespec(op.unmod_since);
@@ -1885,12 +1863,11 @@ static int rgw_bucket_link_olh(cls_method_context_t hctx, bufferlist *in, buffer
   }
 
   /* read olh */
-  if (!olh_read_attempt) { // only read if we didn't attempt earlier
-    ret = olh.init(&olh_found);
-    if (ret < 0) {
-      return ret;
-    }
-    olh_read_attempt = true;
+  BIOLHEntry olh(hctx, op.key);
+  bool olh_found = false;
+  ret = olh.init(&olh_found);
+  if (ret < 0) {
+    return ret;
   }
 
   const uint64_t prev_epoch = olh.get_epoch();