mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2025-01-24 14:28:24 +00:00
Lock fdent_data_lock before accessing pagelist
Found via ThreadSanitizer. References #1353. References #1362.
This commit is contained in:
parent
2bb745cdd7
commit
8de6cb3504
@ -1788,6 +1788,12 @@ bool FdEntity::RenamePath(const string& newpath, string& fentmapkey)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FdEntity::IsModified(void) const
|
||||||
|
{
|
||||||
|
AutoLock auto_data_lock(const_cast<pthread_mutex_t *>(&fdent_data_lock));
|
||||||
|
return pagelist.IsModified();
|
||||||
|
}
|
||||||
|
|
||||||
bool FdEntity::GetStats(struct stat& st, bool lock_already_held)
|
bool FdEntity::GetStats(struct stat& st, bool lock_already_held)
|
||||||
{
|
{
|
||||||
AutoLock auto_lock(&fdent_lock, lock_already_held ? AutoLock::ALREADY_LOCKED : AutoLock::NONE);
|
AutoLock auto_lock(&fdent_lock, lock_already_held ? AutoLock::ALREADY_LOCKED : AutoLock::NONE);
|
||||||
@ -1882,6 +1888,7 @@ bool FdEntity::GetSize(off_t& size)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AutoLock auto_data_lock(&fdent_data_lock);
|
||||||
size = pagelist.Size();
|
size = pagelist.Size();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ class FdEntity
|
|||||||
const char* GetPath(void) const { return path.c_str(); }
|
const char* GetPath(void) const { return path.c_str(); }
|
||||||
bool RenamePath(const std::string& newpath, std::string& fentmapkey);
|
bool RenamePath(const std::string& newpath, std::string& fentmapkey);
|
||||||
int GetFd(void) const { return fd; }
|
int GetFd(void) const { return fd; }
|
||||||
bool IsModified(void) const { return pagelist.IsModified(); }
|
bool IsModified(void) const;
|
||||||
bool MergeOrgMeta(headers_t& updatemeta);
|
bool MergeOrgMeta(headers_t& updatemeta);
|
||||||
|
|
||||||
bool GetStats(struct stat& st, bool lock_already_held = false);
|
bool GetStats(struct stat& st, bool lock_already_held = false);
|
||||||
|
@ -97,6 +97,7 @@ class AutoLock
|
|||||||
~AutoLock();
|
~AutoLock();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
AutoLock(const AutoLock&);
|
||||||
pthread_mutex_t* const auto_mutex;
|
pthread_mutex_t* const auto_mutex;
|
||||||
bool is_lock_acquired;
|
bool is_lock_acquired;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user