]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgwlc: fix removal of delete markers (SAL)
authorMatt Benjamin <mbenjamin@redhat.com>
Mon, 30 Jun 2025 14:26:25 +0000 (10:26 -0400)
committerThomas Serlin <tserlin@redhat.com>
Mon, 22 Sep 2025 19:18:18 +0000 (15:18 -0400)
S3 delete markers do not have head objects, and SAL's Object::load_obj_state()
returns -ENOENT in this case.  Handle this case in LC's remove_expired_obj().

Fixes: https://tracker.ceph.com/issues/70853
Resolves: rhbz#2381933

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
(cherry picked from commit 224821147f2664e54f81b0bb93ccd23669f31f04)

src/rgw/rgw_lc.cc

index a18fbc0e5f0c6eaa9218e79b528b03f1918a3704..ad757851b8ef28954cb758439c13d8c4464e3e86 100644 (file)
@@ -623,10 +623,15 @@ static int remove_expired_obj(const DoutPrefixProvider* dpp,
   auto obj = oc.bucket->get_object(obj_key);
   ret = obj->load_obj_state(dpp, null_yield, true);
   if (ret < 0) {
-    ldpp_dout(oc.dpp, 0) <<
-      fmt::format("ERROR: get_obj_state() failed in {} for object k={} error r={}",
-                 __func__, oc.o.key.to_string(), ret) << dendl;
-    return ret;
+    /* for delete markers, we expect load_obj_state() to "fail"
+     * with -ENOENT */
+    if (! (o.is_delete_marker() &&
+          (ret == -ENOENT))) {
+      ldpp_dout(oc.dpp, 0) <<
+       fmt::format("ERROR: get_obj_state() failed in {} for object k={} error r={}",
+                   __func__, oc.o.key.to_string(), ret) << dendl;
+      return ret;
+    }
   }
 
   auto have_notify = !event_types.empty();
@@ -1280,13 +1285,14 @@ public:
                        << oc.wq->thr_name() << dendl;
       return false;
     }
+    /* don't remove the delete marker if that would expose a non-current
+     * version as current */
     if (oc.next_has_same_name(o.key.name)) {
       ldpp_dout(dpp, 20) << __func__ << "(): key=" << o.key
-                       << ": next is same object, skipping "
+                       << ": dm expiration would expose a non-current version, skipping "
                        << oc.wq->thr_name() << dendl;
       return false;
     }
-
     *exp_time = real_clock::now();
 
     return true;