aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys/wfs.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-01-26 02:50:50 -0800
committerChris Lu <chris.lu@gmail.com>2021-01-26 02:50:53 -0800
commit3a1d3d3413c5fc6a49c138ed5024f2b907f63d37 (patch)
tree387c4e7e4e559942d9bd1d4cfeee1d23599e209f /weed/filesys/wfs.go
parentc41961d5cccf4a4b49e5968e0da283c6fb1f47c3 (diff)
downloadseaweedfs-3a1d3d3413c5fc6a49c138ed5024f2b907f63d37.tar.xz
seaweedfs-3a1d3d3413c5fc6a49c138ed5024f2b907f63d37.zip
mount: properly invalidate kernel node cache entry
fix https://github.com/chrislusf/seaweedfs/issues/1752
Diffstat (limited to 'weed/filesys/wfs.go')
-rw-r--r--weed/filesys/wfs.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go
index 6cfadcc18..108e23c85 100644
--- a/weed/filesys/wfs.go
+++ b/weed/filesys/wfs.go
@@ -76,6 +76,7 @@ type WFS struct {
// throttle writers
concurrentWriters *util.LimitedConcurrentExecutor
+ Server *fs.Server
}
type statsCache struct {
filer_pb.StatisticsResponse
@@ -104,9 +105,22 @@ func NewSeaweedFileSystem(option *Option) *WFS {
fsNode := wfs.fsNodeCache.GetFsNode(filePath)
if fsNode != nil {
if file, ok := fsNode.(*File); ok {
+ if err := wfs.Server.InvalidateNodeData(file); err != nil {
+ glog.V(4).Infof("InvalidateNodeData %s : %v", filePath, err)
+ }
file.clearEntry()
}
}
+ dir, name := filePath.DirAndName()
+ parent := wfs.root
+ if dir != "/" {
+ parent = wfs.fsNodeCache.GetFsNode(util.FullPath(dir))
+ }
+ if parent != nil {
+ if err := wfs.Server.InvalidateEntry(parent, name); err != nil {
+ glog.V(4).Infof("InvalidateEntry %s : %v", filePath, err)
+ }
+ }
})
startTime := time.Now()
go meta_cache.SubscribeMetaEvents(wfs.metaCache, wfs.signature, wfs, wfs.option.FilerMountRootPath, startTime.UnixNano())