mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2025-02-02 18:48:26 +00:00
Merge pull request #697 from pwulff/master
Fixing race condition in FdEntity::GetStats
This commit is contained in:
commit
6b58220009
@ -1001,10 +1001,10 @@ bool FdEntity::OpenAndLoadAll(headers_t* pmeta, size_t* size, bool force_load)
|
|||||||
|
|
||||||
bool FdEntity::GetStats(struct stat& st)
|
bool FdEntity::GetStats(struct stat& st)
|
||||||
{
|
{
|
||||||
|
AutoLock auto_lock(&fdent_lock);
|
||||||
if(-1 == fd){
|
if(-1 == fd){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
AutoLock auto_lock(&fdent_lock);
|
|
||||||
|
|
||||||
memset(&st, 0, sizeof(struct stat));
|
memset(&st, 0, sizeof(struct stat));
|
||||||
if(-1 == fstat(fd, &st)){
|
if(-1 == fstat(fd, &st)){
|
||||||
@ -2116,6 +2116,7 @@ FdEntity* FdManager::ExistOpen(const char* path, int existfd, bool ignore_existf
|
|||||||
|
|
||||||
void FdManager::Rename(const std::string &from, const std::string &to)
|
void FdManager::Rename(const std::string &from, const std::string &to)
|
||||||
{
|
{
|
||||||
|
AutoLock auto_lock(&FdManager::fd_manager_lock);
|
||||||
fdent_map_t::iterator iter = fent.find(from);
|
fdent_map_t::iterator iter = fent.find(from);
|
||||||
if(fent.end() != iter){
|
if(fent.end() != iter){
|
||||||
// found
|
// found
|
||||||
|
Loading…
x
Reference in New Issue
Block a user