From: J. Eric Ivancich Date: Wed, 14 Sep 2022 16:49:27 +0000 (-0400) Subject: rgw: fix bool/int logic error when calling get_obj_head_ioctx X-Git-Tag: v18.1.0~429^2~8^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=28d04e865c1a6d7ef5c2e04727df498380a0b70c;p=ceph-ci.git rgw: fix bool/int logic error when calling get_obj_head_ioctx get_obj_head_ioctx returns an int where 0 indicates success. When called in RGWRados::check_disk_state the result was treated as a booleann with inverted logic. This fixes that error. This was already fixed in PR #44616 as part of a larger commit, but this PR unifies the codebase, so various backports are consistent. This also adds additional logging. Signed-off-by: J. Eric Ivancich --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index d862e83a681..baf99c37099 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -2401,19 +2401,25 @@ std::string RGWRados::get_cluster_fsid(const DoutPrefixProvider *dpp, optional_y return svc.rados->cluster_fsid(); } -int RGWRados::get_obj_head_ioctx(const DoutPrefixProvider *dpp, const RGWBucketInfo& bucket_info, const rgw_obj& obj, librados::IoCtx *ioctx) +int RGWRados::get_obj_head_ioctx(const DoutPrefixProvider *dpp, + const RGWBucketInfo& bucket_info, + const rgw_obj& obj, + librados::IoCtx *ioctx) { - string oid, key; + std::string oid, key; get_obj_bucket_and_oid_loc(obj, oid, key); rgw_pool pool; if (!get_obj_data_pool(bucket_info.placement_rule, obj, &pool)) { - ldpp_dout(dpp, 0) << "ERROR: cannot get data pool for obj=" << obj << ", probably misconfiguration" << dendl; + ldpp_dout(dpp, 0) << "ERROR: cannot get data pool for obj=" << obj << + ", probably misconfiguration" << dendl; return -EIO; } int r = open_pool_ctx(dpp, pool, *ioctx, false); if (r < 0) { + ldpp_dout(dpp, 0) << "ERROR: unable to open data-pool=" << pool.to_str() << + " for obj=" << obj << " with error-code=" << r << dendl; return r; } @@ -9335,8 +9341,8 @@ int RGWRados::check_disk_state(const DoutPrefixProvider *dpp, list_state.meta.storage_class = storage_class; librados::IoCtx head_obj_ctx; // initialize to data pool so we can get pool id - int ret = get_obj_head_ioctx(dpp, bucket_info, obj->get_obj(), &head_obj_ctx); - if (ret < 0) { + r = get_obj_head_ioctx(dpp, bucket_info, obj->get_obj(), &head_obj_ctx); + if (r < 0) { ldpp_dout(dpp, 0) << __func__ << " WARNING: unable to find head object data pool for \"" << obj << "\", not updating version pool/epoch" << dendl;