From 91fd311f7a7e84217f4dde536de50e31948b669b Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 25 Oct 2020 10:33:49 -0700 Subject: [PATCH] fix logic to read entry or not --- weed/filesys/file.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/weed/filesys/file.go b/weed/filesys/file.go index bba4335b7..383986f23 100644 --- a/weed/filesys/file.go +++ b/weed/filesys/file.go @@ -253,15 +253,16 @@ func (file *File) Forget() { } func (file *File) maybeLoadEntry(ctx context.Context) error { - if (len(file.entry.HardLinkId) != 0) && file.isOpen <= 0 { - entry, err := file.wfs.maybeLoadEntry(file.dir.FullPath(), file.Name) - if err != nil { - glog.V(3).Infof("maybeLoadEntry file %s/%s: %v", file.dir.FullPath(), file.Name, err) - return err - } - if entry != nil { - file.setEntry(entry) - } + if file.isOpen > 0 { + return nil + } + entry, err := file.wfs.maybeLoadEntry(file.dir.FullPath(), file.Name) + if err != nil { + glog.V(3).Infof("maybeLoadEntry file %s/%s: %v", file.dir.FullPath(), file.Name, err) + return err + } + if entry != nil { + file.setEntry(entry) } return nil }