aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys/wfs.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-04-16 02:55:09 -0700
committerChris Lu <chris.lu@gmail.com>2021-04-18 13:06:38 -0700
commitd9a2a7f1c4593c20ec9a92b98b726af7b32baff3 (patch)
tree2ce7aa6c2c28a8af76b75e0342af8f157f0d78fb /weed/filesys/wfs.go
parent54410ca955cf4078684bca17b4363dc33ef433ed (diff)
downloadseaweedfs-d9a2a7f1c4593c20ec9a92b98b726af7b32baff3.tar.xz
seaweedfs-d9a2a7f1c4593c20ec9a92b98b726af7b32baff3.zip
WIP
no memory issue if some directory is removed, it may have this error $ rm -Rf ~/tmp/m2/s1 rm: fts_read: Device not configured
Diffstat (limited to 'weed/filesys/wfs.go')
-rw-r--r--weed/filesys/wfs.go31
1 files changed, 15 insertions, 16 deletions
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go
index 2034354f5..7019a464b 100644
--- a/weed/filesys/wfs.go
+++ b/weed/filesys/wfs.go
@@ -103,24 +103,15 @@ func NewSeaweedFileSystem(option *Option) *WFS {
}
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 {
- if err := wfs.Server.InvalidateNodeData(file); err != nil {
- glog.V(4).Infof("InvalidateNodeData %s : %v", filePath, err)
- }
- file.entry = nil
- }
+ fsNode := NodeWithId(filePath.AsInode())
+ if err := wfs.Server.InvalidateNodeData(fsNode); err != nil {
+ glog.V(4).Infof("InvalidateNodeData %s : %v", filePath, err)
}
+
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)
- }
+ parent := NodeWithId(util.FullPath(dir).AsInode())
+ if err := wfs.Server.InvalidateEntry(parent, name); err != nil {
+ glog.V(4).Infof("InvalidateEntry %s : %v", filePath, err)
}
})
startTime := time.Now()
@@ -267,3 +258,11 @@ func (wfs *WFS) LookupFn() wdclient.LookupFileIdFunctionType {
return filer.LookupFn(wfs)
}
+
+type NodeWithId uint64
+func (n NodeWithId) Id() uint64 {
+ return uint64(n)
+}
+func (n NodeWithId) Attr(ctx context.Context, attr *fuse.Attr) error {
+ return nil
+}