diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-10-25 19:24:15 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-10-25 19:24:15 -0700 |
| commit | e71463a9eb74496829c4463cabd1c1a6747b7513 (patch) | |
| tree | f13cdf11ed7df3435111ecdd40dafd69e323b81f /weed/filesys/wfs.go | |
| parent | e219c578490454aced96b046dceb7313dbbb4a47 (diff) | |
| download | seaweedfs-e71463a9eb74496829c4463cabd1c1a6747b7513.tar.xz seaweedfs-e71463a9eb74496829c4463cabd1c1a6747b7513.zip | |
mount: invalide file cache when metadata is changed
Diffstat (limited to 'weed/filesys/wfs.go')
| -rw-r--r-- | weed/filesys/wfs.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go index 912be3c05..759e21b15 100644 --- a/weed/filesys/wfs.go +++ b/weed/filesys/wfs.go @@ -92,7 +92,14 @@ func NewSeaweedFileSystem(option *Option) *WFS { wfs.chunkCache = chunk_cache.NewTieredChunkCache(256, cacheDir, option.CacheSizeMB, 1024*1024) } - wfs.metaCache = meta_cache.NewMetaCache(path.Join(cacheDir, "meta"), util.FullPath(option.FilerMountRootPath), option.UidGidMapper) + wfs.metaCache = meta_cache.NewMetaCache(path.Join(cacheDir, "meta"), util.FullPath(option.FilerMountRootPath), option.UidGidMapper, func(filePath util.FullPath) { + fsNode := wfs.fsNodeCache.GetFsNode(filePath) + if fsNode != nil { + if file, ok := fsNode.(*File); ok { + file.entry = nil + } + } + }) startTime := time.Now() go meta_cache.SubscribeMetaEvents(wfs.metaCache, wfs.signature, wfs, wfs.option.FilerMountRootPath, startTime.UnixNano()) grace.OnInterrupt(func() { |
