From: Casey Bodley Date: Thu, 20 Jun 2024 19:53:17 +0000 (-0400) Subject: rgw/kms: RGWKMIPTransceiver warns about blocking X-Git-Tag: v20.0.0~1583^2~3 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=90a22f0474ab9e16a54ec008b6b6cca3ebef5474;p=ceph.git rgw/kms: RGWKMIPTransceiver warns about blocking Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_kmip_client.cc b/src/rgw/rgw_kmip_client.cc index e801972ea801f..9b75e8eca74b1 100644 --- a/src/rgw/rgw_kmip_client.cc +++ b/src/rgw/rgw_kmip_client.cc @@ -4,6 +4,7 @@ #include "common/Thread.h" #include "include/compat.h" #include "common/errno.h" +#include "rgw_asio_thread.h" #include "rgw_common.h" #include "rgw_kmip_client.h" @@ -15,10 +16,14 @@ RGWKMIPManager *rgw_kmip_manager; int -RGWKMIPTransceiver::wait(optional_yield y) +RGWKMIPTransceiver::wait(const DoutPrefixProvider* dpp, optional_yield y) { if (done) return ret; + + // TODO: when given a coroutine yield context, suspend instead of blocking + maybe_warn_about_blocking(dpp); + std::unique_lock l{lock}; if (!done) cond.wait(l); @@ -39,12 +44,12 @@ RGWKMIPTransceiver::send() } int -RGWKMIPTransceiver::process(optional_yield y) +RGWKMIPTransceiver::process(const DoutPrefixProvider* dpp, optional_yield y) { int r = send(); if (r < 0) return r; - return wait(y); + return wait(dpp, y); } RGWKMIPTransceiver::~RGWKMIPTransceiver() diff --git a/src/rgw/rgw_kmip_client.h b/src/rgw/rgw_kmip_client.h index 2992921136e5d..410bb7d57fe85 100644 --- a/src/rgw/rgw_kmip_client.h +++ b/src/rgw/rgw_kmip_client.h @@ -3,6 +3,7 @@ #pragma once +class DoutPrefixProvider; class RGWKMIPManager; class RGWKMIPTransceiver { @@ -35,7 +36,7 @@ public: ceph::mutex lock = ceph::make_mutex("rgw_kmip_req::lock"); ceph::condition_variable cond; - int wait(optional_yield y); + int wait(const DoutPrefixProvider* dpp, optional_yield y); RGWKMIPTransceiver(CephContext * const cct, kmip_operation operation) : cct(cct), @@ -46,7 +47,7 @@ public: ~RGWKMIPTransceiver(); int send(); - int process(optional_yield y); + int process(const DoutPrefixProvider* dpp, optional_yield y); }; class RGWKMIPManager { diff --git a/src/rgw/rgw_kms.cc b/src/rgw/rgw_kms.cc index f8c6992cf644a..02f7837272c8f 100644 --- a/src/rgw/rgw_kms.cc +++ b/src/rgw/rgw_kms.cc @@ -814,7 +814,7 @@ KmipGetTheKey::get_uniqueid_for_keyname(const DoutPrefixProvider* dpp, RGWKMIPTransceiver secret_req(cct, RGWKMIPTransceiver::LOCATE); secret_req.name = work.data(); - ret = secret_req.process(y); + ret = secret_req.process(dpp, y); if (ret < 0) { failed = true; } else if (!secret_req.outlist->string_count) { @@ -841,7 +841,7 @@ KmipGetTheKey::get_key_for_uniqueid(const DoutPrefixProvider* dpp, if (failed) return ret; RGWKMIPTransceiver secret_req(cct, RGWKMIPTransceiver::GET); secret_req.unique_id = work.data(); - ret = secret_req.process(y); + ret = secret_req.process(dpp, y); if (ret < 0) { failed = true; } else {