Fixed deadlock in S3fsCurl::DestroyCurlHandle

This commit is contained in:
Takeshi Nakatani
2022-07-27 14:00:15 +00:00
committed by Andrew Gaul
parent 4b2f3fecb5
commit e30a5939d0
2 changed files with 4 additions and 4 deletions

View File

@ -1920,7 +1920,7 @@ bool S3fsCurl::CreateCurlHandle(bool only_pool, bool remake)
AutoLock lock(&S3fsCurl::curl_handles_lock);
if(hCurl && remake){
if(!DestroyCurlHandle(false)){
if(!DestroyCurlHandle(false, true, AutoLock::ALREADY_LOCKED)){
S3FS_PRN_ERR("could not destroy handle.");
return false;
}
@ -1945,7 +1945,7 @@ bool S3fsCurl::CreateCurlHandle(bool only_pool, bool remake)
return true;
}
bool S3fsCurl::DestroyCurlHandle(bool restore_pool, bool clear_internal_data)
bool S3fsCurl::DestroyCurlHandle(bool restore_pool, bool clear_internal_data, AutoLock::Type locktype)
{
// [NOTE]
// If type is REQTYPE_IAMCRED or REQTYPE_IAMROLE, do not clear type.
@ -1961,7 +1961,7 @@ bool S3fsCurl::DestroyCurlHandle(bool restore_pool, bool clear_internal_data)
}
if(hCurl){
AutoLock lock(&S3fsCurl::curl_handles_lock);
AutoLock lock(&S3fsCurl::curl_handles_lock, locktype);
S3fsCurl::curl_times.erase(hCurl);
S3fsCurl::curl_progress.erase(hCurl);

View File

@ -336,7 +336,7 @@ class S3fsCurl
// methods
bool CreateCurlHandle(bool only_pool = false, bool remake = false);
bool DestroyCurlHandle(bool restore_pool = true, bool clear_internal_data = true);
bool DestroyCurlHandle(bool restore_pool = true, bool clear_internal_data = true, AutoLock::Type locktype = AutoLock::NONE);
bool GetIAMCredentials(const char* cred_url, const char* iam_v2_token, const char* ibm_secret_access_key, std::string& response);
bool GetIAMRoleFromMetaData(const char* cred_url, const char* iam_v2_token, std::string& token);