From de081c0d64463bb867405874a902fc285d65c31a Mon Sep 17 00:00:00 2001 From: wusong <75450248+wusongANKANG@users.noreply.github.com> Date: Sun, 29 Jan 2023 23:55:27 +0800 Subject: [PATCH] [mount] fix metacache update (#4161) --- weed/mount/meta_cache/meta_cache.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/weed/mount/meta_cache/meta_cache.go b/weed/mount/meta_cache/meta_cache.go index cb2521824..4ec41a2a8 100644 --- a/weed/mount/meta_cache/meta_cache.go +++ b/weed/mount/meta_cache/meta_cache.go @@ -70,8 +70,12 @@ func (mc *MetaCache) AtomicUpdateEntryFromFiler(ctx context.Context, oldPath uti //mc.Lock() //defer mc.Unlock() - oldDir, _ := oldPath.DirAndName() - if mc.isCachedFn(util.FullPath(oldDir)) { + entry, err := mc.FindEntry(ctx, oldPath) + if err != nil && err != filer_pb.ErrNotFound { + glog.Errorf("Metacache: find entry error: %v", err) + return err + } + if entry != nil { if oldPath != "" { if newEntry != nil && oldPath == newEntry.FullPath { // skip the unnecessary deletion