From: Cory Snyder Date: Wed, 14 Jun 2023 14:01:43 +0000 (+0000) Subject: rgw: apply_olh_log should clear_olh before trimming olh log X-Git-Tag: v16.2.14~7^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ee330ed4df2c53ac883e9ab8ad3a412ec5a86900;p=ceph.git rgw: apply_olh_log should clear_olh before trimming olh log When pending_removal is true and the log is trimmed prior to clearing olh, it allows for the possibility that the olh is not cleared (e.g. due to new pending xattrs on the olh obj), but the olh log entries are removed. Signed-off-by: Cory Snyder (cherry picked from commit dfbe4f9cb078bad9a0244ce433a9728f8bd6b912) Conflicts: src/rgw/driver/rados/rgw_rados.cc Cherry-pick notes: - conflicts due to rgw_rados.cc being moved to new directory after Pacific --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 53d12e20f201..4b1cb1c45e2a 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -7358,15 +7358,20 @@ int RGWRados::apply_olh_log(const DoutPrefixProvider *dpp, return r; } - r = bucket_index_trim_olh_log(dpp, bucket_info, state, obj, last_ver); - if (r < 0) { - ldpp_dout(dpp, 0) << "ERROR: could not trim olh log, r=" << r << dendl; - return r; - } if (need_to_remove) { string olh_tag(state.olh_tag.c_str(), state.olh_tag.length()); - clear_olh(dpp, obj_ctx, obj, bucket_info, ref, olh_tag, last_ver, null_yield); + r = clear_olh(dpp, obj_ctx, obj, bucket_info, ref, olh_tag, last_ver, null_yield); + if (r < 0 && r != -ECANCELED) { + ldpp_dout(dpp, 0) << "ERROR: could not clear olh, r=" << r << dendl; + return r; + } + } + + r = bucket_index_trim_olh_log(dpp, bucket_info, state, obj, last_ver); + if (r < 0 && r != -ECANCELED) { + ldpp_dout(dpp, 0) << "ERROR: could not trim olh log, r=" << r << dendl; + return r; } return 0;