From adcb3970de1a1c85c7b5c3a9ecec11438177798f Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Thu, 20 Jun 2024 13:41:06 -0400 Subject: [PATCH] rgw: pass DoutPrefixProvider into RGWHTTPClient Signed-off-by: Casey Bodley --- src/rgw/driver/rados/rgw_data_sync.cc | 6 ++--- src/rgw/driver/rados/rgw_lc_tier.cc | 5 ++-- src/rgw/driver/rados/rgw_notify.cc | 4 +-- src/rgw/driver/rados/rgw_pubsub_push.cc | 16 +++++++----- src/rgw/driver/rados/rgw_pubsub_push.h | 5 +++- src/rgw/driver/rados/rgw_rados.cc | 6 ++--- src/rgw/driver/rados/rgw_sync.cc | 8 +++--- src/rgw/rgw_auth_keystone.cc | 6 ++--- src/rgw/rgw_cr_rest.cc | 6 +++-- src/rgw/rgw_cr_rest.h | 34 ++++++++++++++----------- src/rgw/rgw_http_client.cc | 14 +++++----- src/rgw/rgw_http_client.h | 7 ++--- src/rgw/rgw_keystone.cc | 4 +-- src/rgw/rgw_kms.cc | 18 +++++++------ src/rgw/rgw_opa.cc | 2 +- src/rgw/rgw_rest_client.cc | 7 ++--- src/rgw/rgw_rest_client.h | 2 +- src/rgw/rgw_rest_conn.cc | 18 +++++++------ src/rgw/rgw_rest_conn.h | 30 +++++++++++++--------- src/rgw/rgw_rest_sts.cc | 4 +-- src/rgw/rgw_swift_auth.cc | 2 +- src/test/rgw/test_http_manager.cc | 6 +++-- 22 files changed, 117 insertions(+), 93 deletions(-) diff --git a/src/rgw/driver/rados/rgw_data_sync.cc b/src/rgw/driver/rados/rgw_data_sync.cc index edf97d27975..151fd7fe84e 100644 --- a/src/rgw/driver/rados/rgw_data_sync.cc +++ b/src/rgw/driver/rados/rgw_data_sync.cc @@ -277,7 +277,7 @@ public: return io_block(0); } yield { - op_ret = http_op->wait(shard_info, null_yield); + op_ret = http_op->wait(dpp, shard_info, null_yield); http_op->put(); } @@ -377,7 +377,7 @@ public: } yield { timer.reset(); - op_ret = http_op->wait(&response, null_yield); + op_ret = http_op->wait(dpp, &response, null_yield); http_op->put(); } @@ -495,7 +495,7 @@ public: } int request_complete() override { - int ret = http_op->wait(result, null_yield); + int ret = http_op->wait(sync_env->dpp, result, null_yield); http_op->put(); if (ret < 0 && ret != -ENOENT) { ldpp_dout(sync_env->dpp, 5) << "ERROR: failed to list remote datalog shard, ret=" << ret << dendl; diff --git a/src/rgw/driver/rados/rgw_lc_tier.cc b/src/rgw/driver/rados/rgw_lc_tier.cc index eea5c9b01a7..64c55700eb2 100644 --- a/src/rgw/driver/rados/rgw_lc_tier.cc +++ b/src/rgw/driver/rados/rgw_lc_tier.cc @@ -269,7 +269,7 @@ static int cloud_tier_get_object(RGWLCCloudTierCtx& tier_ctx, bool head, } /* fetch headers */ - ret = tier_ctx.conn.complete_request(in_req, nullptr, nullptr, nullptr, nullptr, &headers, null_yield); + ret = tier_ctx.conn.complete_request(tier_ctx.dpp, in_req, nullptr, nullptr, nullptr, nullptr, &headers, null_yield); if (ret < 0 && ret != -ENOENT) { ldpp_dout(tier_ctx.dpp, 20) << "ERROR: " << __func__ << "(): conn.complete_request() returned ret=" << ret << dendl; return ret; @@ -704,8 +704,7 @@ RGWGetDataCB *RGWLCCloudStreamPut::get_cb() { } int RGWLCCloudStreamPut::complete_request() { - int ret = conn.complete_request(out_req, etag, &obj_properties.mtime, null_yield); - return ret; + return conn.complete_request(dpp, out_req, etag, &obj_properties.mtime, null_yield); } /* Read local copy and write to Cloud endpoint */ diff --git a/src/rgw/driver/rados/rgw_notify.cc b/src/rgw/driver/rados/rgw_notify.cc index f138db1d920..6c1fe53d7e3 100644 --- a/src/rgw/driver/rados/rgw_notify.cc +++ b/src/rgw/driver/rados/rgw_notify.cc @@ -248,7 +248,7 @@ private: << " retry_number: " << entry_persistency_tracker.retires_num << " current time: " << time_now << dendl; - const auto ret = push_endpoint->send(event_entry.event, yield); + const auto ret = push_endpoint->send(this, event_entry.event, yield); if (ret < 0) { ldpp_dout(this, 5) << "WARNING: push entry marker: " << entry.marker << " failed. error: " << ret @@ -1266,7 +1266,7 @@ int publish_commit(rgw::sal::Object* obj, dpp->get_cct()); ldpp_dout(res.dpp, 20) << "INFO: push endpoint created: " << topic.cfg.dest.push_endpoint << dendl; - const auto ret = push_endpoint->send(event_entry.event, res.yield); + const auto ret = push_endpoint->send(dpp, event_entry.event, res.yield); if (ret < 0) { ldpp_dout(dpp, 1) << "ERROR: failed to push sync notification event with error: " diff --git a/src/rgw/driver/rados/rgw_pubsub_push.cc b/src/rgw/driver/rados/rgw_pubsub_push.cc index f2a7affcb03..eb7f854cca8 100644 --- a/src/rgw/driver/rados/rgw_pubsub_push.cc +++ b/src/rgw/driver/rados/rgw_pubsub_push.cc @@ -88,7 +88,8 @@ public: } } - int send(const rgw_pubsub_s3_event& event, optional_yield y) override { + int send(const DoutPrefixProvider* dpp, const rgw_pubsub_s3_event& event, + optional_yield y) override { std::shared_lock lock(s_http_manager_mutex); if (!s_http_manager) { ldout(cct, 1) << "ERROR: send failed. http endpoint manager not running" << dendl; @@ -114,7 +115,7 @@ public: if (perfcounter) perfcounter->inc(l_rgw_pubsub_push_pending); auto rc = s_http_manager->add_request(&request); if (rc == 0) { - rc = request.wait(y); + rc = request.wait(dpp, y); } if (perfcounter) perfcounter->dec(l_rgw_pubsub_push_pending); // TODO: use read_bl to process return code and handle according to ack level @@ -144,7 +145,7 @@ class Waiter { mutable std::condition_variable cond; public: - int wait(optional_yield y) { + int wait(const DoutPrefixProvider* dpp, optional_yield y) { std::unique_lock l{lock}; if (done) { return ret; @@ -247,7 +248,7 @@ public: } } - int send(const rgw_pubsub_s3_event& event, optional_yield y) override { + int send(const DoutPrefixProvider* dpp, const rgw_pubsub_s3_event& event, optional_yield y) override { if (ack_level == ack_level_t::None) { return amqp::publish(conn_id, topic, json_format_pubsub_event(event)); } else { @@ -262,7 +263,7 @@ public: // failed to publish, does not wait for reply return rc; } - return w->wait(y); + return w->wait(dpp, y); } } @@ -320,7 +321,8 @@ public: } } - int send(const rgw_pubsub_s3_event& event, optional_yield y) override { + int send(const DoutPrefixProvider* dpp, const rgw_pubsub_s3_event& event, + optional_yield y) override { if (ack_level == ack_level_t::None) { return kafka::publish(conn_id, topic, json_format_pubsub_event(event)); } else { @@ -332,7 +334,7 @@ public: // failed to publish, does not wait for reply return rc; } - return w->wait(y); + return w->wait(dpp, y); } } diff --git a/src/rgw/driver/rados/rgw_pubsub_push.h b/src/rgw/driver/rados/rgw_pubsub_push.h index bacebfba44c..84207c5a1d7 100644 --- a/src/rgw/driver/rados/rgw_pubsub_push.h +++ b/src/rgw/driver/rados/rgw_pubsub_push.h @@ -8,6 +8,7 @@ #include "include/common_fwd.h" #include "common/async/yield_context.h" +class DoutPrefixProvider; class RGWHTTPArgs; struct rgw_pubsub_s3_event; @@ -28,7 +29,9 @@ public: // this method is used in order to send notification and wait for completion // in async manner via a coroutine when invoked in the frontend environment - virtual int send(const rgw_pubsub_s3_event& event, optional_yield y) = 0; + virtual int send(const DoutPrefixProvider* dpp, + const rgw_pubsub_s3_event& event, + optional_yield y) = 0; // present as string virtual std::string to_str() const = 0; diff --git a/src/rgw/driver/rados/rgw_rados.cc b/src/rgw/driver/rados/rgw_rados.cc index ce35ed20be4..c307b3a4ed8 100644 --- a/src/rgw/driver/rados/rgw_rados.cc +++ b/src/rgw/driver/rados/rgw_rados.cc @@ -4083,7 +4083,7 @@ int RGWRados::stat_remote_obj(const DoutPrefixProvider *dpp, return ret; } - ret = conn->complete_request(in_stream_req, nullptr, &set_mtime, psize, + ret = conn->complete_request(dpp, in_stream_req, nullptr, &set_mtime, psize, nullptr, pheaders, y); if (ret < 0) { if (ret == -EIO && tries < NUM_ENPOINT_IOERROR_RETRIES - 1) { @@ -4318,7 +4318,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx, goto set_err_state; } - ret = conn->complete_request(in_stream_req, &etag, &set_mtime, + ret = conn->complete_request(rctx.dpp, in_stream_req, &etag, &set_mtime, &accounted_size, nullptr, nullptr, rctx.y); if (ret < 0) { if (ret == -EIO && tries < NUM_ENPOINT_IOERROR_RETRIES - 1) { @@ -4578,7 +4578,7 @@ int RGWRados::copy_obj_to_remote_dest(const DoutPrefixProvider *dpp, return ret; } - ret = rest_master_conn->complete_request(out_stream_req, etag, mtime, y); + ret = rest_master_conn->complete_request(dpp, out_stream_req, etag, mtime, y); if (ret < 0) { if (ret == -EIO && tries < NUM_ENPOINT_IOERROR_RETRIES - 1) { ldpp_dout(dpp, 20) << __func__ << "(): failed to put_obj_async_init. retries=" << tries << dendl; diff --git a/src/rgw/driver/rados/rgw_sync.cc b/src/rgw/driver/rados/rgw_sync.cc index 583e2d1098e..bd730dfd6c2 100644 --- a/src/rgw/driver/rados/rgw_sync.cc +++ b/src/rgw/driver/rados/rgw_sync.cc @@ -505,7 +505,7 @@ public: return io_block(0); } yield { - op_ret = http_op->wait(shard_info, null_yield); + op_ret = http_op->wait(dpp, shard_info, null_yield); http_op->put(); } @@ -586,7 +586,7 @@ public: } int request_complete() override { - int ret = http_op->wait(result, null_yield); + int ret = http_op->wait(sync_env->dpp, result, null_yield); http_op->put(); if (ret < 0 && ret != -ENOENT) { ldpp_dout(sync_env->dpp, 5) << "ERROR: failed to list remote mdlog shard, ret=" << ret << dendl; @@ -1089,7 +1089,7 @@ public: return io_block(0); } yield { - op_ret = http_op->wait(pbl, null_yield); + op_ret = http_op->wait(dpp, pbl, null_yield); http_op->put(); } @@ -2547,7 +2547,7 @@ int RGWCloneMetaLogCoroutine::state_send_rest_request(const DoutPrefixProvider * int RGWCloneMetaLogCoroutine::state_receive_rest_response() { - op_ret = http_op->wait(&data, null_yield); + op_ret = http_op->wait(sync_env->dpp, &data, null_yield); if (op_ret < 0 && op_ret != -EIO) { error_stream << "http operation failed: " << http_op->to_str() << " status=" << http_op->get_http_status() << std::endl; ldpp_dout(sync_env->dpp, 5) << "failed to wait for op, ret=" << op_ret << dendl; diff --git a/src/rgw/rgw_auth_keystone.cc b/src/rgw/rgw_auth_keystone.cc index 0bcd1a32b0f..9a0a973df43 100644 --- a/src/rgw/rgw_auth_keystone.cc +++ b/src/rgw/rgw_auth_keystone.cc @@ -88,7 +88,7 @@ admin_token_retry: validate.set_url(url); - ret = validate.process(y); + ret = validate.process(dpp, y); /* NULL terminate for debug output. */ token_body_bl.append(static_cast(0)); @@ -464,7 +464,7 @@ EC2Engine::get_from_keystone(const DoutPrefixProvider* dpp, const std::string_vi validate.set_send_length(os.str().length()); /* send request */ - ret = validate.process(y); + ret = validate.process(dpp, y); /* if the supplied signature is wrong, we will get 401 from Keystone */ if (validate.get_http_status() == @@ -544,7 +544,7 @@ auto EC2Engine::get_secret_from_keystone(const DoutPrefixProvider* dpp, secret.set_verify_ssl(cct->_conf->rgw_keystone_verify_ssl); /* send request */ - ret = secret.process(y); + ret = secret.process(dpp, y); /* if the supplied access key isn't found, we will get 404 from Keystone */ if (secret.get_http_status() == diff --git a/src/rgw/rgw_cr_rest.cc b/src/rgw/rgw_cr_rest.cc index 04920a1551b..fce41decb41 100644 --- a/src/rgw/rgw_cr_rest.cc +++ b/src/rgw/rgw_cr_rest.cc @@ -84,7 +84,8 @@ RGWStreamReadHTTPResourceCRF::~RGWStreamReadHTTPResourceCRF() { if (req) { req->cancel(); - req->wait(null_yield); + auto dpp = NoDoutPrefix{cct, ceph_subsys_rgw}; + req->wait(&dpp, null_yield); delete req; } } @@ -188,7 +189,8 @@ RGWStreamWriteHTTPResourceCRF::~RGWStreamWriteHTTPResourceCRF() { if (req) { req->cancel(); - req->wait(null_yield); + auto dpp = NoDoutPrefix{cct, ceph_subsys_rgw}; + req->wait(&dpp, null_yield); delete req; } } diff --git a/src/rgw/rgw_cr_rest.h b/src/rgw/rgw_cr_rest.h index 531d7ee68ef..4b9c0de445a 100644 --- a/src/rgw/rgw_cr_rest.h +++ b/src/rgw/rgw_cr_rest.h @@ -90,14 +90,13 @@ public: - virtual int wait_result() { - return http_op->wait(result, null_yield); + virtual int wait_result(const DoutPrefixProvider* dpp) { + return http_op->wait(dpp, result, null_yield); } int request_complete() override { - int ret; - - ret = wait_result(); + auto dpp = NoDoutPrefix{cct, ceph_subsys_rgw}; + int ret = wait_result(&dpp); auto op = std::move(http_op); // release ref on return if (ret < 0) { @@ -138,8 +137,8 @@ class RGWReadRESTResourceCR : public RGWReadRawRESTResourceCR { : RGWReadRawRESTResourceCR(_cct, _conn, _http_manager, _path, params, hdrs), result(_result) {} - int wait_result() override { - return http_op->wait(result, null_yield); + int wait_result(const DoutPrefixProvider* dpp) override { + return http_op->wait(dpp, result, null_yield); } }; @@ -207,12 +206,13 @@ class RGWSendRawRESTResourceCR: public RGWSimpleCoroutine { } int request_complete() override { + auto dpp = NoDoutPrefix{cct, ceph_subsys_rgw}; int ret; if (result || err_result) { - ret = http_op->wait(result, null_yield, err_result); + ret = http_op->wait(&dpp, result, null_yield, err_result); } else { bufferlist bl; - ret = http_op->wait(&bl, null_yield); + ret = http_op->wait(&dpp, &bl, null_yield); } auto op = std::move(http_op); // release ref on return if (ret < 0) { @@ -366,9 +366,9 @@ public: } int request_complete() override { - int ret; + auto dpp = NoDoutPrefix{cct, ceph_subsys_rgw}; bufferlist bl; - ret = http_op->wait(&bl, null_yield); + int ret = http_op->wait(&dpp, &bl, null_yield); auto op = std::move(http_op); // release ref on return if (ret < 0) { error_stream << "http operation failed: " << op->to_str() @@ -517,6 +517,7 @@ public: class RGWStreamWriteHTTPResourceCRF : public RGWStreamWriteResourceCRF { protected: + CephContext *cct; RGWCoroutinesEnv *env; RGWCoroutine *caller; RGWHTTPManager *http_manager; @@ -546,10 +547,13 @@ public: RGWStreamWriteHTTPResourceCRF(CephContext *_cct, RGWCoroutinesEnv *_env, RGWCoroutine *_caller, - RGWHTTPManager *_http_manager) : env(_env), - caller(_caller), - http_manager(_http_manager), - write_drain_notify_cb(this) {} + RGWHTTPManager *_http_manager) + : cct(_cct), + env(_env), + caller(_caller), + http_manager(_http_manager), + write_drain_notify_cb(this) + {} virtual ~RGWStreamWriteHTTPResourceCRF(); int init() override { diff --git a/src/rgw/rgw_http_client.cc b/src/rgw/rgw_http_client.cc index abbb9a04608..83a83626db4 100644 --- a/src/rgw/rgw_http_client.cc +++ b/src/rgw/rgw_http_client.cc @@ -71,7 +71,7 @@ struct rgw_http_req_data : public RefCountedObject { }, token, ex); } - int wait(optional_yield y) { + int wait(const DoutPrefixProvider* dpp, optional_yield y) { std::unique_lock l{lock}; if (done) { return ret; @@ -534,9 +534,9 @@ static bool is_upload_request(const string& method) /* * process a single simple one off request */ -int RGWHTTPClient::process(optional_yield y) +int RGWHTTPClient::process(const DoutPrefixProvider* dpp, optional_yield y) { - return RGWHTTP::process(this, y); + return RGWHTTP::process(dpp, this, y); } string RGWHTTPClient::to_str() @@ -648,9 +648,9 @@ bool RGWHTTPClient::is_done() /* * wait for async request to complete */ -int RGWHTTPClient::wait(optional_yield y) +int RGWHTTPClient::wait(const DoutPrefixProvider* dpp, optional_yield y) { - return req_data->wait(y); + return req_data->wait(dpp, y); } void RGWHTTPClient::cancel() @@ -1214,7 +1214,7 @@ int RGWHTTP::send(RGWHTTPClient *req) { return 0; } -int RGWHTTP::process(RGWHTTPClient *req, optional_yield y) { +int RGWHTTP::process(const DoutPrefixProvider* dpp, RGWHTTPClient *req, optional_yield y) { if (!req) { return 0; } @@ -1223,6 +1223,6 @@ int RGWHTTP::process(RGWHTTPClient *req, optional_yield y) { return r; } - return req->wait(y); + return req->wait(dpp, y); } diff --git a/src/rgw/rgw_http_client.h b/src/rgw/rgw_http_client.h index ef188390326..51833585c83 100644 --- a/src/rgw/rgw_http_client.h +++ b/src/rgw/rgw_http_client.h @@ -151,9 +151,9 @@ public: req_timeout = timeout; } - int process(optional_yield y); + int process(const DoutPrefixProvider* dpp, optional_yield y); - int wait(optional_yield y); + int wait(const DoutPrefixProvider* dpp, optional_yield y); void cancel(); bool is_done(); @@ -349,5 +349,6 @@ class RGWHTTP { public: static int send(RGWHTTPClient *req); - static int process(RGWHTTPClient *req, optional_yield y); + static int process(const DoutPrefixProvider* dpp, RGWHTTPClient *req, + optional_yield y); }; diff --git a/src/rgw/rgw_keystone.cc b/src/rgw/rgw_keystone.cc index 2fa35d74f6f..8a0873a047c 100644 --- a/src/rgw/rgw_keystone.cc +++ b/src/rgw/rgw_keystone.cc @@ -212,7 +212,7 @@ int Service::issue_admin_token_request(const DoutPrefixProvider *dpp, token_req.set_url(token_url); - const int ret = token_req.process(y); + const int ret = token_req.process(dpp, y); /* Detect rejection earlier than during the token parsing step. */ if (token_req.get_http_status() == @@ -290,7 +290,7 @@ int Service::get_keystone_barbican_token(const DoutPrefixProvider *dpp, token_req.set_url(token_url); ldpp_dout(dpp, 20) << "Requesting secret from barbican url=" << token_url << dendl; - const int ret = token_req.process(y); + const int ret = token_req.process(dpp, y); if (ret < 0) { ldpp_dout(dpp, 20) << "Barbican process error:" << token_bl.c_str() << dendl; return ret; diff --git a/src/rgw/rgw_kms.cc b/src/rgw/rgw_kms.cc index d5854ccea92..f8c6992cf64 100644 --- a/src/rgw/rgw_kms.cc +++ b/src/rgw/rgw_kms.cc @@ -306,7 +306,7 @@ protected: secret_req.set_client_key(kctx.ssl_clientkey()); } - res = secret_req.process(y); + res = secret_req.process(dpp, y); // map 401 to EACCES instead of EPERM if (secret_req.get_http_status() == @@ -782,8 +782,8 @@ private: protected: KmipGetTheKey(CephContext *cct) : cct(cct) {} KmipGetTheKey& keyid_to_keyname(std::string_view key_id); - KmipGetTheKey& get_uniqueid_for_keyname(optional_yield y); - int get_key_for_uniqueid(optional_yield y, std::string &); + KmipGetTheKey& get_uniqueid_for_keyname(const DoutPrefixProvider* dpp, optional_yield y); + int get_key_for_uniqueid(const DoutPrefixProvider* dpp, optional_yield y, std::string &); friend KmipSecretEngine; }; @@ -808,7 +808,8 @@ KmipGetTheKey::keyid_to_keyname(std::string_view key_id) } KmipGetTheKey& -KmipGetTheKey::get_uniqueid_for_keyname(optional_yield y) +KmipGetTheKey::get_uniqueid_for_keyname(const DoutPrefixProvider* dpp, + optional_yield y) { RGWKMIPTransceiver secret_req(cct, RGWKMIPTransceiver::LOCATE); @@ -834,7 +835,8 @@ KmipGetTheKey::get_uniqueid_for_keyname(optional_yield y) } int -KmipGetTheKey::get_key_for_uniqueid(optional_yield y, std::string& actual_key) +KmipGetTheKey::get_key_for_uniqueid(const DoutPrefixProvider* dpp, + optional_yield y, std::string& actual_key) { if (failed) return ret; RGWKMIPTransceiver secret_req(cct, RGWKMIPTransceiver::GET); @@ -866,8 +868,8 @@ public: int r; r = KmipGetTheKey{cct} .keyid_to_keyname(key_id) - .get_uniqueid_for_keyname(y) - .get_key_for_uniqueid(y, actual_key); + .get_uniqueid_for_keyname(dpp, y) + .get_key_for_uniqueid(dpp, y, actual_key); return r; } }; @@ -937,7 +939,7 @@ static int request_key_from_barbican(const DoutPrefixProvider *dpp, secret_req.append_header("Accept", "application/octet-stream"); secret_req.append_header("X-Auth-Token", barbican_token); - res = secret_req.process(y); + res = secret_req.process(dpp, y); // map 401 to EACCES instead of EPERM if (secret_req.get_http_status() == RGWHTTPTransceiver::HTTP_STATUS_UNAUTHORIZED) { diff --git a/src/rgw/rgw_opa.cc b/src/rgw/rgw_opa.cc index 7422615aec9..0bda4d62a51 100644 --- a/src/rgw/rgw_opa.cc +++ b/src/rgw/rgw_opa.cc @@ -71,7 +71,7 @@ int rgw_opa_authorize(RGWOp *& op, req.set_send_length(ss.str().length()); /* send request */ - ret = req.process(null_yield); + ret = req.process(op, s->yield); if (ret < 0) { ldpp_dout(op, 2) << "OPA process error:" << bl.c_str() << dendl; return ret; diff --git a/src/rgw/rgw_rest_client.cc b/src/rgw/rgw_rest_client.cc index 941856e6006..45b5e3076f4 100644 --- a/src/rgw/rgw_rest_client.cc +++ b/src/rgw/rgw_rest_client.cc @@ -452,7 +452,7 @@ int RGWRESTSimpleRequest::forward_request(const DoutPrefixProvider *dpp, const R method = new_info.method; url = new_url; - int r = process(y); + int r = process(dpp, y); if (r < 0){ if (r == -EINVAL){ // curl_easy has errored, generally means the service is not available @@ -922,14 +922,15 @@ int RGWRESTStreamRWRequest::send(RGWHTTPManager *mgr) return RGWHTTPStreamRWRequest::send(mgr); } -int RGWHTTPStreamRWRequest::complete_request(optional_yield y, +int RGWHTTPStreamRWRequest::complete_request(const DoutPrefixProvider* dpp, + optional_yield y, string *etag, real_time *mtime, uint64_t *psize, map *pattrs, map *pheaders) { - int ret = wait(y); + int ret = wait(dpp, y); if (ret < 0) { return ret; } diff --git a/src/rgw/rgw_rest_client.h b/src/rgw/rgw_rest_client.h index 923f8cc1783..ffedcc17a94 100644 --- a/src/rgw/rgw_rest_client.h +++ b/src/rgw/rgw_rest_client.h @@ -168,7 +168,7 @@ public: virtual int send(RGWHTTPManager *mgr); - int complete_request(optional_yield y, + int complete_request(const DoutPrefixProvider* dpp, optional_yield y, std::string *etag = nullptr, real_time *mtime = nullptr, uint64_t *psize = nullptr, diff --git a/src/rgw/rgw_rest_conn.cc b/src/rgw/rgw_rest_conn.cc index 39d171dfb52..770ccae2990 100644 --- a/src/rgw/rgw_rest_conn.cc +++ b/src/rgw/rgw_rest_conn.cc @@ -257,10 +257,11 @@ int RGWRESTConn::put_obj_async_init(const DoutPrefixProvider *dpp, const rgw_own return 0; } -int RGWRESTConn::complete_request(RGWRESTStreamS3PutObj *req, string& etag, +int RGWRESTConn::complete_request(const DoutPrefixProvider* dpp, + RGWRESTStreamS3PutObj *req, string& etag, real_time *mtime, optional_yield y) { - int ret = req->complete_request(y, &etag, mtime); + int ret = req->complete_request(dpp, y, &etag, mtime); if (ret == -EIO) { ldout(cct, 5) << __func__ << ": complete_request() returned ret=" << ret << dendl; set_url_unconnectable(req->get_url_orig()); @@ -408,7 +409,8 @@ done_err: return r; } -int RGWRESTConn::complete_request(RGWRESTStreamRWRequest *req, +int RGWRESTConn::complete_request(const DoutPrefixProvider* dpp, + RGWRESTStreamRWRequest *req, string *etag, real_time *mtime, uint64_t *psize, @@ -416,7 +418,7 @@ int RGWRESTConn::complete_request(RGWRESTStreamRWRequest *req, map *pheaders, optional_yield y) { - int ret = req->complete_request(y, etag, mtime, psize, pattrs, pheaders); + int ret = req->complete_request(dpp, y, etag, mtime, psize, pattrs, pheaders); if (ret == -EIO) { ldout(cct, 5) << __func__ << ": complete_request() returned ret=" << ret << dendl; set_url_unconnectable(req->get_url_orig()); @@ -467,7 +469,7 @@ int RGWRESTConn::get_resource(const DoutPrefixProvider *dpp, return ret; } - ret = req.complete_request(y); + ret = req.complete_request(dpp, y); if (ret == -EIO) { set_url_unconnectable(url); if (tries < NUM_ENPOINT_IOERROR_RETRIES - 1) { @@ -521,7 +523,7 @@ int RGWRESTConn::send_resource(const DoutPrefixProvider *dpp, const std::string& return ret; } - ret = req.complete_request(y); + ret = req.complete_request(dpp, y); if (ret == -EIO) { set_url_unconnectable(url); if (tries < NUM_ENPOINT_IOERROR_RETRIES - 1) { @@ -580,7 +582,7 @@ int RGWRESTReadResource::read(const DoutPrefixProvider *dpp, optional_yield y) return ret; } - ret = req.complete_request(y); + ret = req.complete_request(dpp, y); if (ret == -EIO) { conn->set_url_unconnectable(req.get_url_orig()); ldpp_dout(dpp, 20) << __func__ << ": complete_request() returned ret=" << ret << dendl; @@ -647,7 +649,7 @@ int RGWRESTSendResource::send(const DoutPrefixProvider *dpp, bufferlist& outbl, return ret; } - ret = req.complete_request(y); + ret = req.complete_request(dpp, y); if (ret == -EIO) { conn->set_url_unconnectable(req.get_url_orig()); ldpp_dout(dpp, 20) << __func__ << ": complete_request() returned ret=" << ret << dendl; diff --git a/src/rgw/rgw_rest_conn.h b/src/rgw/rgw_rest_conn.h index b2d1affb640..7abf86a3d3f 100644 --- a/src/rgw/rgw_rest_conn.h +++ b/src/rgw/rgw_rest_conn.h @@ -140,7 +140,8 @@ public: int put_obj_send_init(const rgw_obj& obj, const rgw_http_param_pair *extra_params, RGWRESTStreamS3PutObj **req); int put_obj_async_init(const DoutPrefixProvider *dpp, const rgw_owner& uid, const rgw_obj& obj, std::map& attrs, RGWRESTStreamS3PutObj **req); - int complete_request(RGWRESTStreamS3PutObj *req, std::string& etag, + int complete_request(const DoutPrefixProvider* dpp, + RGWRESTStreamS3PutObj *req, std::string& etag, ceph::real_time *mtime, optional_yield y); struct get_obj_params { @@ -178,7 +179,8 @@ public: bool prepend_metadata, bool get_op, bool rgwx_stat, bool sync_manifest, bool skip_decrypt, rgw_zone_set_entry *dst_zone_trace, bool sync_cloudtiered, bool send, RGWHTTPStreamRWRequest::ReceiveCB *cb, RGWRESTStreamRWRequest **req); - int complete_request(RGWRESTStreamRWRequest *req, + int complete_request(const DoutPrefixProvider* dpp, + RGWRESTStreamRWRequest *req, std::string *etag, ceph::real_time *mtime, uint64_t *psize, @@ -344,8 +346,8 @@ public: return req.get_http_status(); } - int wait(bufferlist *pbl, optional_yield y) { - int ret = req.wait(y); + int wait(const DoutPrefixProvider* dpp, bufferlist *pbl, optional_yield y) { + int ret = req.wait(dpp, y); if (ret < 0) { if (ret == -EIO) { conn->set_url_unconnectable(req.get_url_orig()); @@ -361,7 +363,7 @@ public: } template - int wait(T *dest, optional_yield y); + int wait(const DoutPrefixProvider* dpp, T *dest, optional_yield y); template int fetch(const DoutPrefixProvider *dpp, T *dest, optional_yield y); @@ -398,9 +400,10 @@ int RGWRESTReadResource::fetch(const DoutPrefixProvider *dpp, T *dest, optional_ } template -int RGWRESTReadResource::wait(T *dest, optional_yield y) +int RGWRESTReadResource::wait(const DoutPrefixProvider* dpp, T *dest, + optional_yield y) { - int ret = req.wait(y); + int ret = req.wait(dpp, y); if (ret < 0) { if (ret == -EIO) { conn->set_url_unconnectable(req.get_url_orig()); @@ -472,8 +475,9 @@ public: } template - int wait(bufferlist *pbl, optional_yield y, E *err_result = nullptr) { - int ret = req.wait(y); + int wait(const DoutPrefixProvider* dpp, bufferlist *pbl, + optional_yield y, E *err_result = nullptr) { + int ret = req.wait(dpp, y); *pbl = bl; if (ret == -EIO) { @@ -488,13 +492,15 @@ public: } template - int wait(T *dest, optional_yield y, E *err_result = nullptr); + int wait(const DoutPrefixProvider* dpp, T *dest, + optional_yield y, E *err_result = nullptr); }; template -int RGWRESTSendResource::wait(T *dest, optional_yield y, E *err_result) +int RGWRESTSendResource::wait(const DoutPrefixProvider* dpp, T *dest, + optional_yield y, E *err_result) { - int ret = req.wait(y); + int ret = req.wait(dpp, y); if (ret == -EIO) { conn->set_url_unconnectable(req.get_url_orig()); } diff --git a/src/rgw/rgw_rest_sts.cc b/src/rgw/rgw_rest_sts.cc index b9c23aa159c..6df53f612cd 100644 --- a/src/rgw/rgw_rest_sts.cc +++ b/src/rgw/rgw_rest_sts.cc @@ -315,7 +315,7 @@ WebTokenEngine::get_cert_url(const string& iss, const DoutPrefixProvider *dpp, o //Headers openidc_req.append_header("Content-Type", "application/x-www-form-urlencoded"); - int res = openidc_req.process(y); + int res = openidc_req.process(dpp, y); if (res < 0) { ldpp_dout(dpp, 10) << "HTTP request res: " << res << dendl; throw -EINVAL; @@ -353,7 +353,7 @@ WebTokenEngine::validate_signature(const DoutPrefixProvider* dpp, const jwt::dec //Headers cert_req.append_header("Content-Type", "application/x-www-form-urlencoded"); - int res = cert_req.process(y); + int res = cert_req.process(dpp, y); if (res < 0) { ldpp_dout(dpp, 10) << "HTTP request res: " << res << dendl; throw -EINVAL; diff --git a/src/rgw/rgw_swift_auth.cc b/src/rgw/rgw_swift_auth.cc index af60a0e275d..032b3734bf9 100644 --- a/src/rgw/rgw_swift_auth.cc +++ b/src/rgw/rgw_swift_auth.cc @@ -479,7 +479,7 @@ ExternalTokenEngine::authenticate(const DoutPrefixProvider* dpp, ldpp_dout(dpp, 10) << "rgw_swift_validate_token url=" << url_buf << dendl; - int ret = validator.process(y); + int ret = validator.process(dpp, y); if (ret < 0) { throw ret; } diff --git a/src/test/rgw/test_http_manager.cc b/src/test/rgw/test_http_manager.cc index f2daeddca79..400ac32f411 100644 --- a/src/test/rgw/test_http_manager.cc +++ b/src/test/rgw/test_http_manager.cc @@ -76,7 +76,8 @@ TEST(HTTPManager, ReadTruncated) const auto url = std::string{"http://127.0.0.1:"} + std::to_string(acceptor.local_endpoint().port()); RGWHTTPClient client{g_ceph_context, "GET", url}; - EXPECT_EQ(-EAGAIN, RGWHTTP::process(&client, null_yield)); + const auto dpp = NoDoutPrefix{g_ceph_context, ceph_subsys_rgw}; + EXPECT_EQ(-EAGAIN, RGWHTTP::process(&dpp, &client, null_yield)); server.join(); } @@ -100,7 +101,8 @@ TEST(HTTPManager, Head) const auto url = std::string{"http://127.0.0.1:"} + std::to_string(acceptor.local_endpoint().port()); RGWHTTPClient client{g_ceph_context, "HEAD", url}; - EXPECT_EQ(0, RGWHTTP::process(&client, null_yield)); + const auto dpp = NoDoutPrefix{g_ceph_context, ceph_subsys_rgw}; + EXPECT_EQ(0, RGWHTTP::process(&dpp, &client, null_yield)); server.join(); } -- 2.39.5