From c4566681459a3d3eb5774cc7b0abeeebeeada838 Mon Sep 17 00:00:00 2001 From: Daniel Gryniewicz Date: Wed, 2 Mar 2022 10:54:29 -0500 Subject: [PATCH] RGW - Fix inverted return check get_obj_head_ioctx() returns the standard int but the call was casting it to a bool, inverting it's meaning. Fix it to act correctly. Fixes: https://tracker.ceph.com/issues/54452 Signed-off-by: Daniel Gryniewicz (cherry picked from commit 988c09d5ad7d32238dbf59792ea336a6d933cef8) --- src/rgw/rgw_rados.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 5fb9e9f3c48b5..2e418c205c4ce 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -9203,15 +9203,14 @@ int RGWRados::check_disk_state(const DoutPrefixProvider *dpp, list_state.meta.content_type = content_type; librados::IoCtx head_obj_ctx; // initialize to data pool so we can get pool id - const bool head_pool_found = - get_obj_head_ioctx(dpp, bucket_info, obj, &head_obj_ctx); - if (head_pool_found) { - list_state.ver.pool = head_obj_ctx.get_id(); - list_state.ver.epoch = astate->epoch; - } else { + int ret = get_obj_head_ioctx(dpp, bucket_info, obj, &head_obj_ctx); + if (ret < 0) { ldpp_dout(dpp, 0) << __PRETTY_FUNCTION__ << " WARNING: unable to find head object data pool for \"" << obj << "\", not updating version pool/epoch" << dendl; + } else { + list_state.ver.pool = head_obj_ctx.get_id(); + list_state.ver.epoch = astate->epoch; } if (astate->obj_tag.length() > 0) { -- 2.39.5