From: Oguzhan Ozmen Date: Wed, 6 May 2026 19:17:55 +0000 (+0000) Subject: rgw/multisite: fix endpoint unreachable detection in RGWRESTConn sync paths X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=28f2a5e22afaae6794a1f6fe766b61ad0afe8024;p=ceph.git rgw/multisite: fix endpoint unreachable detection in RGWRESTConn sync paths The checks that decide whether to call set_endpoint_unconnectable() were comparing against -EIO, but the actual error codes returned on connection failure changed after commit 37352a9074 ("rgw: change rgw_http_error_to_errno default to -ERR_INTERNAL_ERROR"). - complete_request() -> wait() returns req_data->ret which is set to rgw_http_error_to_errno(0) = -ERR_INTERNAL_ERROR when http_status is 0 (TCP connect failed). Fix the six call sites to check -ERR_INTERNAL_ERROR. - forward_request() returns tl::unexpected(-ERR_SERVICE_UNAVAILABLE) when http_status == 0 (no HTTP response received at all). Fix the two forward/forward_iam conditionals to check -ERR_SERVICE_UNAVAILABLE. Without this fix, connection failures are never detected in the sync paths, so set_endpoint_unconnectable() is never called and the IP failover / retry logic is effectively dead. The .h coroutine paths were already fixed by dbb409e21b9 ("rgw: fix endpoint detection in RGWRESTConn") but that commit missed all .cc sync paths. Signed-off-by: Oguzhan Ozmen --- diff --git a/src/rgw/rgw_rest_conn.cc b/src/rgw/rgw_rest_conn.cc index 46f6685c6fd..ce3425f6e8c 100644 --- a/src/rgw/rgw_rest_conn.cc +++ b/src/rgw/rgw_rest_conn.cc @@ -329,7 +329,7 @@ auto RGWRESTConn::forward(const DoutPrefixProvider *dpp, const rgw_owner& uid, auto result = req.forward_request(dpp, key, info, max_response, inbl, outbl, y); if (result) { return result; - } else if (result.error() != -EIO) { + } else if (result.error() != -ERR_SERVICE_UNAVAILABLE) { return result; } set_endpoint_unconnectable(endpoint); @@ -360,7 +360,7 @@ auto RGWRESTConn::forward_iam(const DoutPrefixProvider *dpp, const req_info& inf auto result = req.forward_request(dpp, key, info, max_response, inbl, outbl, y, service); if (result) { return result; - } else if (result.error() != -EIO) { + } else if (result.error() != -ERR_SERVICE_UNAVAILABLE) { return result; } set_endpoint_unconnectable(endpoint); @@ -415,7 +415,7 @@ int RGWRESTConn::complete_request(const DoutPrefixProvider* dpp, real_time *mtime, optional_yield y) { int ret = req->complete_request(dpp, y, &etag, mtime); - if (ret == -EIO) { + if (ret == -ERR_INTERNAL_ERROR) { ldout(cct, 5) << __func__ << ": complete_request() returned ret=" << ret << dendl; set_endpoint_unconnectable(req->get_endpoint()); } @@ -578,7 +578,7 @@ int RGWRESTConn::complete_request(const DoutPrefixProvider* dpp, optional_yield y) { int ret = req->complete_request(dpp, y, etag, mtime, psize, pattrs, pheaders); - if (ret == -EIO) { + if (ret == -ERR_INTERNAL_ERROR) { ldout(cct, 5) << __func__ << ": complete_request() returned ret=" << ret << dendl; set_endpoint_unconnectable(req->get_endpoint()); } @@ -629,7 +629,7 @@ int RGWRESTConn::get_resource(const DoutPrefixProvider *dpp, } ret = req.complete_request(dpp, y); - if (ret == -EIO) { + if (ret == -ERR_INTERNAL_ERROR) { set_endpoint_unconnectable(endpoint); if (tries < NUM_ENPOINT_IOERROR_RETRIES - 1) { ldpp_dout(dpp, 20) << __func__ << "(): failed to get resource. retries=" << tries << dendl; @@ -683,7 +683,7 @@ int RGWRESTConn::send_resource(const DoutPrefixProvider *dpp, const std::string& } ret = req.complete_request(dpp, y); - if (ret == -EIO) { + if (ret == -ERR_INTERNAL_ERROR) { set_endpoint_unconnectable(endpoint); if (tries < NUM_ENPOINT_IOERROR_RETRIES - 1) { ldpp_dout(dpp, 20) << __func__ << "(): failed to send resource. retries=" << tries << dendl; @@ -742,7 +742,7 @@ int RGWRESTReadResource::read(const DoutPrefixProvider *dpp, optional_yield y) } ret = req.complete_request(dpp, y); - if (ret == -EIO) { + if (ret == -ERR_INTERNAL_ERROR) { conn->set_endpoint_unconnectable(req.get_endpoint()); ldpp_dout(dpp, 20) << __func__ << ": complete_request() returned ret=" << ret << dendl; } @@ -809,7 +809,7 @@ int RGWRESTSendResource::send(const DoutPrefixProvider *dpp, bufferlist& outbl, } ret = req.complete_request(dpp, y); - if (ret == -EIO) { + if (ret == -ERR_INTERNAL_ERROR) { conn->set_endpoint_unconnectable(req.get_endpoint()); ldpp_dout(dpp, 20) << __func__ << ": complete_request() returned ret=" << ret << dendl; }