From 0b68b68ec4a3f967f56a10e3d156e18139e771c4 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Thu, 29 Oct 2020 16:32:45 -0700 Subject: [PATCH] reload entry only when it is a hard link fix https://github.com/chrislusf/seaweedfs/issues/1581 --- weed/filesys/file.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/weed/filesys/file.go b/weed/filesys/file.go index 7aa1016d7..fb7b83cbe 100644 --- a/weed/filesys/file.go +++ b/weed/filesys/file.go @@ -253,9 +253,15 @@ func (file *File) Forget() { } func (file *File) maybeLoadEntry(ctx context.Context) error { - if (file.entry != nil && len(file.entry.HardLinkId) != 0) || file.isOpen > 0 { + if file.isOpen > 0 { return nil } + if file.entry != nil { + if len(file.entry.HardLinkId) == 0 { + // only always reload hard link + 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) @@ -263,6 +269,8 @@ func (file *File) maybeLoadEntry(ctx context.Context) error { } if entry != nil { file.setEntry(entry) + } else { + glog.Warningf("maybeLoadEntry not found entry %s/%s: %v", file.dir.FullPath(), file.Name, err) } return nil }