diff --git a/core/cfg/config.go b/core/cfg/config.go index f8d3ef95..b044ac50 100644 --- a/core/cfg/config.go +++ b/core/cfg/config.go @@ -108,6 +108,7 @@ type FlagStorage struct { NoPreloadDir bool NoVerifySSL bool WinRefreshDirs bool + NoEvictRootChilds bool // Debugging DebugMain bool diff --git a/core/cfg/flags.go b/core/cfg/flags.go index f98e8155..1a92d1ee 100644 --- a/core/cfg/flags.go +++ b/core/cfg/flags.go @@ -619,6 +619,11 @@ MISC OPTIONS: Value: 512, Usage: "Simultaneously opened cache file descriptor limit", }, + cli.BoolFlag{ + Name: "no-evict-root-childs", + Usage: "Do not evict inode if it parent is RootInode." + + " Useful if you mount one bucket and docker mount the bucket's child folders.", + }, } if runtime.GOOS == "windows" { @@ -876,6 +881,7 @@ func PopulateFlags(c *cli.Context) (ret *FlagStorage) { PreferPatchUploads: c.Bool("prefer-patch-uploads"), NoPreloadDir: c.Bool("no-preload-dir"), NoVerifySSL: c.Bool("no-verify-ssl"), + NoEvictRootChilds: c.Bool("no-evict-root-childs"), // Common Backend Config Endpoint: c.String("endpoint"), diff --git a/core/goofys.go b/core/goofys.go index 2f743cb0..e1262c32 100644 --- a/core/goofys.go +++ b/core/goofys.go @@ -684,6 +684,13 @@ func (fs *Goofys) EvictEntry(id fuseops.InodeID) bool { childTmp.isDir() && atomic.LoadInt64(&childTmp.dir.ModifiedChildren) > 0 { return false } + // Do not evict inode if it parent is RootInode + if fs.flags.NoEvictRootChilds && childTmp.Parent.Id == fuseops.RootInodeID { + log.Debugf("Do not evict root child: inode %v, name %v, parent inode %v", childTmp.Id, childTmp.Name, childTmp.Parent.Id) + childNewExprTime := time.Now() + childTmp.SetExpireTime(childNewExprTime) + return false + } if !childTmp.mu.TryLock() { return false }