diff --git a/weed/filesys/file.go b/weed/filesys/file.go index fb7b83cbe..d2ae34654 100644 --- a/weed/filesys/file.go +++ b/weed/filesys/file.go @@ -301,6 +301,12 @@ func (file *File) setEntry(entry *filer_pb.Entry) { file.reader = nil } +func (file *File) clearEntry() { + file.entry = nil + file.entryViewCache = nil + file.reader = nil +} + func (file *File) saveEntry() error { return file.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error { diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go index 293b09dcf..d31579fce 100644 --- a/weed/filesys/wfs.go +++ b/weed/filesys/wfs.go @@ -96,7 +96,7 @@ func NewSeaweedFileSystem(option *Option) *WFS { fsNode := wfs.fsNodeCache.GetFsNode(filePath) if fsNode != nil { if file, ok := fsNode.(*File); ok { - file.setEntry(nil) + file.clearEntry() } } })