From 988c09d5ad7d32238dbf59792ea336a6d933cef8 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 --- 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 f992532fe38..6cc26a99bd9 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -9210,15 +9210,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.47.3