[mount] fix metacache update (#4161)

This commit is contained in:
wusong 2023-01-29 23:55:27 +08:00 committed by GitHub
parent b63d1e9c6b
commit de081c0d64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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