From 615c32991893ee43f274f80535d04489dd71bf0a Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 6 Sep 2020 00:16:30 +0100 Subject: Support mapper rejection signalled by 0 st_mode --- netfs/fuse/fuseDirs.cpp | 11 +++++++---- netfs/fuse/fuseFiles.cpp | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/netfs/fuse/fuseDirs.cpp b/netfs/fuse/fuseDirs.cpp index c1a91bd..d23f5d7 100644 --- a/netfs/fuse/fuseDirs.cpp +++ b/netfs/fuse/fuseDirs.cpp @@ -50,13 +50,16 @@ namespace NetFS { auto expiry = time(nullptr) + 2; if (flags == FUSE_READDIR_PLUS) { for (const auto & e : od->remote->listdir()) { - filler(buf, e.first.c_str(), nullptr, 0, FUSE_FILL_DIR_PLUS); - std::string k(path + e.first); - statCache.remove(k); - statCache.add(k, converter.convert(e.second), expiry); + if (auto stat = converter.convert(e.second); stat.st_mode) { + filler(buf, e.first.c_str(), nullptr, 0, FUSE_FILL_DIR_PLUS); + std::string k(path + e.first); + statCache.remove(k); + statCache.add(k, std::move(stat), expiry); + } } } else { + // Standard read dir cannot know the local system cannot represent the inode for (const auto & e : od->remote->readdir()) { filler(buf, e.c_str(), nullptr, 0, (fuse_fill_dir_flags)0); } diff --git a/netfs/fuse/fuseFiles.cpp b/netfs/fuse/fuseFiles.cpp index 0a59252..8014732 100644 --- a/netfs/fuse/fuseFiles.cpp +++ b/netfs/fuse/fuseFiles.cpp @@ -256,7 +256,7 @@ namespace NetFS { *s = converter.convert(volume->getattr(reqEnv(), p)); } } - return 0; + return s->st_mode ? 0 : -ENOENT; } catch (SystemError & e) { return -e.syserrno; -- cgit v1.2.3