From eaaee359c30a5d0855f3d1cbf50d47877fb50627 Mon Sep 17 00:00:00 2001 From: Antonio SJ Musumeci Date: Tue, 13 Feb 2024 23:56:52 -0600 Subject: [PATCH] fuse_getattr.cpp --- src/fuse_getattr.cpp | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/src/fuse_getattr.cpp b/src/fuse_getattr.cpp index 4cb95c6e..0f293b74 100644 --- a/src/fuse_getattr.cpp +++ b/src/fuse_getattr.cpp @@ -140,25 +140,31 @@ namespace l StrVec basepaths; thread_local static std::unordered_map cache; - auto i = cache.find(fusepath_); - if(i == cache.end()) + for(int c = 0; c < 2; c++) { - rv = searchFunc_(branches_,fusepath_,&basepaths); - if(rv == -1) - return -errno; - - auto rv = cache.insert({fusepath_,basepaths[0]}); - i = rv.first; + auto i = cache.find(fusepath_); + if(i == cache.end()) + { + rv = searchFunc_(branches_,fusepath_,&basepaths); + if(rv == -1) + return -errno; + + auto rv = cache.insert({fusepath_,basepaths[0]}); + i = rv.first; + } + + fullpath = fs::path::make(i->second,fusepath_); + + rv = l::getattr(fullpath,followsymlinks_,st_); + if((rv == -1) && (errno == ENOENT)) + { + cache.erase(fusepath_); + continue; + } } - fullpath = fs::path::make(i->second,fusepath_); - - rv = l::getattr(fullpath,followsymlinks_,st_); if(rv == -1) - { - cache.erase(fusepath_); - return -errno; - } + return -errno; if(symlinkify_ && symlinkify::can_be_symlink(*st_,symlinkify_timeout_)) symlinkify::convert(fullpath,st_);