]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: rgw_admin also inits curl
authorAbhishek Lekshmanan <abhishek@suse.com>
Fri, 2 Mar 2018 09:41:51 +0000 (10:41 +0100)
committerAbhishek Lekshmanan <abhishek@suse.com>
Fri, 2 Mar 2018 16:42:00 +0000 (17:42 +0100)
since we use http manager which in turn uses curl and uses curl multi
interfaces. While curl is initialized at the first call of curl_easy_init() this
method isn't guaranteed to be safe when multiple threads may call the function
since curl_global_init isn't reentrant. Calling curl_global_init via
rgw::curl::setup_curl which additionally sets up ssl interfaces etc. when
openssl is used as curl's ssl backend. Similarly moving rgw target link to
accomodate this change.

Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
CMakeLists.txt
src/rgw/CMakeLists.txt
src/rgw/rgw_admin.cc

index fbbb0ca9db0eb05c6595382f97959323512ba9bc..f20b9e81f1f9731d05d01b303d9448a052263be0 100644 (file)
@@ -412,6 +412,7 @@ if (WITH_RADOSGW)
   find_package(OpenSSL)
   if (OPENSSL_FOUND)
     if (NOT NO_CURL_SSL_LINK)
+      message(STATUS "libcurl is linked with openssl: explicitly setting locks")
       set(WITH_CURL_OPENSSL ON)
     endif() # CURL_SSL_LINK
     execute_process(
index 1acdc8a3cf60950e1dea2692197aa7deec35690c..7b1e64577afa4437778881001aad199b687ed33e 100644 (file)
@@ -157,6 +157,10 @@ if (WITH_RADOSGW_BEAST_FRONTEND)
   target_link_libraries(rgw_a Boost::coroutine Boost::context)
 endif()
 
+if (WITH_CURL_OPENSSL)
+  target_link_libraries(rgw_a ${OPENSSL_LIBRARIES})
+endif (WITH_CURL_OPENSSL)
+
 set(radosgw_srcs
   rgw_loadgen_process.cc
   rgw_civetweb.cc
@@ -191,10 +195,6 @@ add_dependencies(radosgw cls_rgw cls_lock cls_refcount
   cls_version cls_replica_log cls_user)
 install(TARGETS radosgw DESTINATION bin)
 
-if (WITH_CURL_OPENSSL)
-  target_link_libraries(radosgw ${OPENSSL_LIBRARIES})
-endif (WITH_CURL_OPENSSL)
-
 set(radosgw_admin_srcs
   rgw_admin.cc
   rgw_orphan.cc)
index 345ca7b5d32ef4b7fef7b4c8382001d9c5983a93..821dac58b199e38cd83744dabf0e90737ba37344 100644 (file)
@@ -44,7 +44,7 @@
 #include "rgw_realm_watcher.h"
 #include "rgw_role.h"
 #include "rgw_reshard.h"
-
+#include "rgw_http_client_curl.h"
 
 #define dout_context g_ceph_context
 #define dout_subsys ceph_subsys_rgw
@@ -3014,6 +3014,7 @@ int main(int argc, const char **argv)
 
   rgw_user_init(store);
   rgw_bucket_init(store->meta_mgr);
+  rgw::curl::setup_curl(boost::none);
 
   StoreDestructor store_destructor(store);
 
@@ -7246,5 +7247,6 @@ next:
     }
   }
 
+  rgw::curl::cleanup_curl();
   return 0;
 }