From 26459672fec3caccf915f15d3dea6a00eff27187 Mon Sep 17 00:00:00 2001 From: Cory Snyder Date: Mon, 25 Jul 2022 16:04:09 -0400 Subject: [PATCH] rgw: optimizations for handling ECANCELED errors within get_obj_state These optimizations for handling ECANCELED errors should prevent some needless RADOS queries upstream. Signed-off-by: Cory Snyder (cherry picked from commit 01982c894386dd4430f99e453d92f9241cb18e9e) --- src/rgw/rgw_rados.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index e9989f430c8..167619a124f 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -7298,9 +7298,6 @@ int RGWRados::apply_olh_log(const DoutPrefixProvider *dpp, /* update olh object */ r = rgw_rados_operate(dpp, ref.pool.ioctx(), ref.obj.oid, &op, null_yield); - if (r == -ECANCELED) { - r = 0; - } if (r < 0) { ldpp_dout(dpp, 0) << "ERROR: could not apply olh update, r=" << r << dendl; return r; @@ -7611,6 +7608,12 @@ int RGWRados::follow_olh(const DoutPrefixProvider *dpp, const RGWBucketInfo& buc int ret = update_olh(dpp, obj_ctx, state, bucket_info, olh_obj); if (ret < 0) { + if (ret == -ECANCELED) { + // In this context, ECANCELED means that the OLH tag changed in either the bucket index entry or the OLH object. + // If the OLH tag changed, it indicates that a previous OLH entry was removed since this request started. We + // return ENOENT to indicate that the OLH object was removed. + ret = -ENOENT; + } return ret; } } -- 2.47.3