Skip to content

Commit 2248211

Browse files
committed
rgwlc: fix removal of delete markers (SAL)
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 <[email protected]>
1 parent 5aeaa10 commit 2248211

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/rgw/rgw_lc.cc

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -623,10 +623,15 @@ static int remove_expired_obj(const DoutPrefixProvider* dpp,
623623
auto obj = oc.bucket->get_object(obj_key);
624624
ret = obj->load_obj_state(dpp, null_yield, true);
625625
if (ret < 0) {
626-
ldpp_dout(oc.dpp, 0) <<
627-
fmt::format("ERROR: get_obj_state() failed in {} for object k={} error r={}",
628-
__func__, oc.o.key.to_string(), ret) << dendl;
629-
return ret;
626+
/* for delete markers, we expect load_obj_state() to "fail"
627+
* with -ENOENT */
628+
if (! (o.is_delete_marker() &&
629+
(ret == -ENOENT))) {
630+
ldpp_dout(oc.dpp, 0) <<
631+
fmt::format("ERROR: get_obj_state() failed in {} for object k={} error r={}",
632+
__func__, oc.o.key.to_string(), ret) << dendl;
633+
return ret;
634+
}
630635
}
631636

632637
auto have_notify = !event_types.empty();
@@ -1280,13 +1285,14 @@ class LCOpAction_DMExpiration : public LCOpAction {
12801285
<< oc.wq->thr_name() << dendl;
12811286
return false;
12821287
}
1288+
/* don't remove the delete marker if that would expose a non-current
1289+
* version as current */
12831290
if (oc.next_has_same_name(o.key.name)) {
12841291
ldpp_dout(dpp, 20) << __func__ << "(): key=" << o.key
1285-
<< ": next is same object, skipping "
1292+
<< ": dm expiration would expose a non-current version, skipping "
12861293
<< oc.wq->thr_name() << dendl;
12871294
return false;
12881295
}
1289-
12901296
*exp_time = real_clock::now();
12911297

12921298
return true;

0 commit comments

Comments
 (0)