mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2025-02-09 22:18:26 +00:00
fix streamuplod not working (#2204)
fuse_main will do fork to daemonize. if ThreadPool is created before this, worker thread will not be placed in child process. Move ThreadPool Init to s3fs_init and destory to s3fs_destory. Signed-off-by: liubingrun <liubr1@chinatelecom.cn>
This commit is contained in:
parent
06d0852e74
commit
a8edbd8622
19
src/s3fs.cpp
19
src/s3fs.cpp
@ -4241,6 +4241,11 @@ static void* s3fs_init(struct fuse_conn_info* conn)
|
|||||||
conn->want |= FUSE_CAP_BIG_WRITES;
|
conn->want |= FUSE_CAP_BIG_WRITES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!ThreadPoolMan::Initialize(max_thread_count)){
|
||||||
|
S3FS_PRN_CRIT("Could not create thread pool(%d)", max_thread_count);
|
||||||
|
s3fs_exit_fuseloop(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
// Signal object
|
// Signal object
|
||||||
if(!S3fsSignals::Initialize()){
|
if(!S3fsSignals::Initialize()){
|
||||||
S3FS_PRN_ERR("Failed to initialize signal object, but continue...");
|
S3FS_PRN_ERR("Failed to initialize signal object, but continue...");
|
||||||
@ -4258,6 +4263,8 @@ static void s3fs_destroy(void*)
|
|||||||
S3FS_PRN_WARN("Failed to clean up signal object.");
|
S3FS_PRN_WARN("Failed to clean up signal object.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ThreadPoolMan::Destroy();
|
||||||
|
|
||||||
// cache(remove at last)
|
// cache(remove at last)
|
||||||
if(is_remove_cache && (!CacheFileStat::DeleteCacheFileStatDirectory() || !FdManager::DeleteCacheDirectory())){
|
if(is_remove_cache && (!CacheFileStat::DeleteCacheFileStatDirectory() || !FdManager::DeleteCacheDirectory())){
|
||||||
S3FS_PRN_WARN("Could not remove cache directory.");
|
S3FS_PRN_WARN("Could not remove cache directory.");
|
||||||
@ -5664,15 +5671,6 @@ int main(int argc, char* argv[])
|
|||||||
max_dirty_data = -1;
|
max_dirty_data = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!ThreadPoolMan::Initialize(max_thread_count)){
|
|
||||||
S3FS_PRN_EXIT("Could not create thread pool(%d)", max_thread_count);
|
|
||||||
S3fsCurl::DestroyS3fsCurl();
|
|
||||||
s3fs_destroy_global_ssl();
|
|
||||||
destroy_parser_xml_lock();
|
|
||||||
destroy_basename_lock();
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// check free disk space
|
// check free disk space
|
||||||
if(!FdManager::IsSafeDiskSpace(NULL, S3fsCurl::GetMultipartSize() * S3fsCurl::GetMaxParallelCount())){
|
if(!FdManager::IsSafeDiskSpace(NULL, S3fsCurl::GetMultipartSize() * S3fsCurl::GetMaxParallelCount())){
|
||||||
S3FS_PRN_EXIT("There is no enough disk space for used as cache(or temporary) directory by s3fs.");
|
S3FS_PRN_EXIT("There is no enough disk space for used as cache(or temporary) directory by s3fs.");
|
||||||
@ -5736,9 +5734,6 @@ int main(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
fuse_opt_free_args(&custom_args);
|
fuse_opt_free_args(&custom_args);
|
||||||
|
|
||||||
// Destroy thread pool
|
|
||||||
ThreadPoolMan::Destroy();
|
|
||||||
|
|
||||||
// Destroy curl
|
// Destroy curl
|
||||||
if(!S3fsCurl::DestroyS3fsCurl()){
|
if(!S3fsCurl::DestroyS3fsCurl()){
|
||||||
S3FS_PRN_WARN("Could not release curl library.");
|
S3FS_PRN_WARN("Could not release curl library.");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user