mirror of
https://github.com/trapexit/mergerfs.git
synced 2025-03-15 02:35:12 +08:00
initialize mutex to fix lockup
This commit is contained in:
parent
2dbcd2b07a
commit
50ad648ce4
@ -229,8 +229,8 @@ static ssize_t fuse_buf_copy_one(const struct fuse_buf *dst, size_t dst_off,
|
|||||||
int dst_is_fd = dst->flags & FUSE_BUF_IS_FD;
|
int dst_is_fd = dst->flags & FUSE_BUF_IS_FD;
|
||||||
|
|
||||||
if (!src_is_fd && !dst_is_fd) {
|
if (!src_is_fd && !dst_is_fd) {
|
||||||
void *dstmem = dst->mem + dst_off;
|
char *dstmem = dst->mem + dst_off;
|
||||||
void *srcmem = src->mem + src_off;
|
char *srcmem = src->mem + src_off;
|
||||||
|
|
||||||
if (dstmem != srcmem) {
|
if (dstmem != srcmem) {
|
||||||
if (dstmem + len <= srcmem || srcmem + len <= dstmem)
|
if (dstmem + len <= srcmem || srcmem + len <= dstmem)
|
||||||
|
@ -2638,6 +2638,7 @@ static void fuse_lib_getattr(fuse_req_t req, fuse_ino_t ino,
|
|||||||
|
|
||||||
memset(&buf, 0, sizeof(buf));
|
memset(&buf, 0, sizeof(buf));
|
||||||
|
|
||||||
|
path = NULL;
|
||||||
err = (((fi == NULL) || (f->fs->op.fgetattr == NULL)) ?
|
err = (((fi == NULL) || (f->fs->op.fgetattr == NULL)) ?
|
||||||
get_path(f,ino,&path) :
|
get_path(f,ino,&path) :
|
||||||
get_path_nullok(f,ino,&path));
|
get_path_nullok(f,ino,&path));
|
||||||
@ -2711,6 +2712,7 @@ static void fuse_lib_setattr(fuse_req_t req, fuse_ino_t ino, struct stat *attr,
|
|||||||
|
|
||||||
memset(&buf, 0, sizeof(buf));
|
memset(&buf, 0, sizeof(buf));
|
||||||
|
|
||||||
|
path = NULL;
|
||||||
err = ((fi == NULL) ?
|
err = ((fi == NULL) ?
|
||||||
get_path(f,ino,&path) :
|
get_path(f,ino,&path) :
|
||||||
get_path_nullok(f,ino,&path));
|
get_path_nullok(f,ino,&path));
|
||||||
|
@ -38,11 +38,15 @@ PolicyCache::Value::Value()
|
|||||||
PolicyCache::PolicyCache(void)
|
PolicyCache::PolicyCache(void)
|
||||||
: timeout(DEFAULT_TIMEOUT)
|
: timeout(DEFAULT_TIMEOUT)
|
||||||
{
|
{
|
||||||
|
pthread_mutex_init(&_lock,NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PolicyCache::erase(const char *fusepath_)
|
PolicyCache::erase(const char *fusepath_)
|
||||||
{
|
{
|
||||||
|
if(timeout == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
pthread_mutex_lock(&_lock);
|
pthread_mutex_lock(&_lock);
|
||||||
|
|
||||||
_cache.erase(fusepath_);
|
_cache.erase(fusepath_);
|
||||||
@ -56,6 +60,9 @@ PolicyCache::cleanup(const int prob_)
|
|||||||
uint64_t now;
|
uint64_t now;
|
||||||
map<string,Value>::iterator i;
|
map<string,Value>::iterator i;
|
||||||
|
|
||||||
|
if(timeout == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
if(rand() % prob_)
|
if(rand() % prob_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user