From 65e3e9b588838a0c50bb06bf4d34d922475989f6 Mon Sep 17 00:00:00 2001 From: Jane Zhu Date: Mon, 18 Dec 2023 22:37:44 -0500 Subject: [PATCH] rgw: revert PR #41897 to allow multiple delete markers to be created Signed-off-by: Juan Zhu --- src/cls/rgw/cls_rgw.cc | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/src/cls/rgw/cls_rgw.cc b/src/cls/rgw/cls_rgw.cc index 2b73fb3b7aa70..aa47be003005c 100644 --- a/src/cls/rgw/cls_rgw.cc +++ b/src/cls/rgw/cls_rgw.cc @@ -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(); -- 2.39.5