mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-09-28 17:29:02 +00:00
Access FdEntity metadata while holding fdent_lock
Create copies to avoid thread races. Found via ThreadSanitizer.
Follows on to ecf13a8cb9
.
This commit is contained in:
parent
80972aa33d
commit
afd438d363
@ -1479,7 +1479,15 @@ int FdEntity::RowFlush(const char* tpath, bool force_sync)
|
|||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
S3FS_PRN_INFO3("[tpath=%s][path=%s][fd=%d]", SAFESTRPTR(tpath), path.c_str(), fd);
|
std::string tmppath;
|
||||||
|
headers_t tmporgmeta;
|
||||||
|
{
|
||||||
|
AutoLock auto_lock(&fdent_lock);
|
||||||
|
tmppath = path;
|
||||||
|
tmporgmeta = orgmeta;
|
||||||
|
}
|
||||||
|
|
||||||
|
S3FS_PRN_INFO3("[tpath=%s][path=%s][fd=%d]", SAFESTRPTR(tpath), tmppath.c_str(), fd);
|
||||||
|
|
||||||
if(-1 == fd){
|
if(-1 == fd){
|
||||||
return -EBADF;
|
return -EBADF;
|
||||||
@ -1554,10 +1562,10 @@ int FdEntity::RowFlush(const char* tpath, bool force_sync)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(pagelist.Size() >= S3fsCurl::GetMultipartSize() && !nomultipart){
|
if(pagelist.Size() >= S3fsCurl::GetMultipartSize() && !nomultipart){
|
||||||
result = S3fsCurl::ParallelMultipartUploadRequest(tpath ? tpath : path.c_str(), orgmeta, fd);
|
result = S3fsCurl::ParallelMultipartUploadRequest(tpath ? tpath : tmppath.c_str(), tmporgmeta, fd);
|
||||||
}else{
|
}else{
|
||||||
S3fsCurl s3fscurl(true);
|
S3fsCurl s3fscurl(true);
|
||||||
result = s3fscurl.PutRequest(tpath ? tpath : path.c_str(), orgmeta, fd);
|
result = s3fscurl.PutRequest(tpath ? tpath : tmppath.c_str(), tmporgmeta, fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// seek to head of file.
|
// seek to head of file.
|
||||||
|
Loading…
Reference in New Issue
Block a user