Fixed data race in threads found thread sanitizer

This commit is contained in:
Takeshi Nakatani 2023-07-09 05:15:27 +00:00 committed by Andrew Gaul
parent 2e51908bec
commit b2537052ef
3 changed files with 4 additions and 5 deletions

View File

@ -2078,13 +2078,13 @@ bool S3fsCurl::DestroyCurlHandle(bool restore_pool, bool clear_internal_data, Au
type = REQTYPE_UNSET;
}
AutoLock lock(&S3fsCurl::curl_handles_lock, locktype);
if(clear_internal_data){
ClearInternalData();
}
if(hCurl){
AutoLock lock(&S3fsCurl::curl_handles_lock, locktype);
S3fsCurl::curl_times.erase(hCurl);
S3fsCurl::curl_progress.erase(hCurl);
sCurlPool->ReturnHandler(hCurl, restore_pool);

View File

@ -2533,7 +2533,7 @@ bool FdEntity::PunchHole(off_t start, size_t size)
//
void FdEntity::MarkDirtyNewFile()
{
AutoLock auto_lock(&fdent_data_lock);
AutoLock auto_lock(&fdent_lock);
pagelist.Init(0, false, true);
pending_status = CREATE_FILE_PENDING;
@ -2541,7 +2541,7 @@ void FdEntity::MarkDirtyNewFile()
bool FdEntity::IsDirtyNewFile() const
{
AutoLock auto_lock(&fdent_data_lock);
AutoLock auto_lock(&fdent_lock);
return (CREATE_FILE_PENDING == pending_status);
}

View File

@ -3022,7 +3022,6 @@ static int s3fs_release(const char* _path, struct fuse_file_info* fi)
bool is_new_file = ent->IsDirtyNewFile();
// TODO: correct locks held?
if(0 != (result = ent->UploadPending(static_cast<int>(fi->fh), AutoLock::NONE))){
S3FS_PRN_ERR("could not upload pending data(meta, etc) for pseudo_fd(%llu) / path(%s)", (unsigned long long)(fi->fh), path);
return result;