mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-12-22 16:58:55 +00:00
Merge pull request #1363 from gaul/is-modified-race
Lock fdent_data_lock before accessing pagelist
This commit is contained in:
commit
46acbf10ba
@ -1788,6 +1788,12 @@ bool FdEntity::RenamePath(const string& newpath, string& fentmapkey)
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
AutoLock auto_data_lock(&fdent_data_lock);
|
||||
size = pagelist.Size();
|
||||
return true;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ class FdEntity
|
||||
const char* GetPath(void) const { return path.c_str(); }
|
||||
bool RenamePath(const std::string& newpath, std::string& fentmapkey);
|
||||
int GetFd(void) const { return fd; }
|
||||
bool IsModified(void) const { return pagelist.IsModified(); }
|
||||
bool IsModified(void) const;
|
||||
bool MergeOrgMeta(headers_t& updatemeta);
|
||||
|
||||
bool GetStats(struct stat& st, bool lock_already_held = false);
|
||||
|
@ -97,6 +97,7 @@ class AutoLock
|
||||
~AutoLock();
|
||||
|
||||
private:
|
||||
AutoLock(const AutoLock&);
|
||||
pthread_mutex_t* const auto_mutex;
|
||||
bool is_lock_acquired;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user