]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/kms: RGWKMIPTransceiver warns about blocking
authorCasey Bodley <cbodley@redhat.com>
Thu, 20 Jun 2024 19:53:17 +0000 (15:53 -0400)
committerCasey Bodley <cbodley@redhat.com>
Tue, 2 Jul 2024 14:36:32 +0000 (10:36 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_kmip_client.cc
src/rgw/rgw_kmip_client.h
src/rgw/rgw_kms.cc

index e801972ea801f368f5aae29b40e9401987984690..9b75e8eca74b1399feab2ead1c300b2a15e83c15 100644 (file)
@@ -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"
 
 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()
index 2992921136e5ddbeda81815c5b59ede5ac50706b..410bb7d57fe85b28a83c45c487dfc437f8116102 100644 (file)
@@ -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 {
index f8c6992cf644ab88ff97ecaab0e96da57c152c45..02f7837272c8f47386a84cec25823f3badd2dc41 100644 (file)
@@ -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 {