Skip to content

Commit

Permalink
Merge pull request #1392 from trapexit/usr1
Browse files Browse the repository at this point in the history
Send invalidate node request outside lock
  • Loading branch information
trapexit authored Jan 10, 2025
2 parents 248b1ac + 0197984 commit bc382e0
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions libfuse/lib/fuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
#include "fuse_pollhandle.h"
#include "fuse_msgbuf.hpp"

#include <vector>
#include <string>

#include <assert.h>
#include <dlfcn.h>
#include <errno.h>
Expand Down Expand Up @@ -3902,8 +3905,7 @@ void
fuse_invalidate_all_nodes()
{
struct fuse *f = fuse_get_fuse_obj();

syslog(LOG_INFO,"invalidating file entries");
std::vector<std::string> names;

pthread_mutex_lock(&f->lock);
for(size_t i = 0; i < f->id_table.size; i++)
Expand All @@ -3914,16 +3916,28 @@ fuse_invalidate_all_nodes()
{
if(node->nodeid == FUSE_ROOT_ID)
continue;
if(node->name == NULL)
continue;
if(node->parent == NULL)
continue;
if(node->parent->nodeid != FUSE_ROOT_ID)
continue;

fuse_lowlevel_notify_inval_entry(f->se->ch,
node->parent->nodeid,
node->name,
strlen(node->name));
names.emplace_back(node->name);
}
}
pthread_mutex_unlock(&f->lock);

syslog(LOG_INFO,
"invalidating %ld file entries",
names.size());
for(auto &name : names)
{
fuse_lowlevel_notify_inval_entry(f->se->ch,
FUSE_ROOT_ID,
name.c_str(),
name.size());
}
}

void
Expand Down

0 comments on commit bc382e0

Please sign in to comment.