]> git.apps.os.sepia.ceph.com Git - ceph.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)
committerMatt Benjamin <mbenjamin@redhat.com>
Mon, 30 Jun 2025 14:26:25 +0000 (10:26 -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
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/rgw/rgw_lc.cc

index 663b7a41899c0f3eeec2d8d46fb7339e354645b3..14be7150d4a7fc04b32e188eda8d80231433dfc0 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;