fix(clinet): remove node for dir when released

Signed-off-by: chihe <chihe@oppo.com>
This commit is contained in:
chihe 2025-01-14 10:14:25 +08:00 committed by Victor1319
parent 6c23d05e80
commit 78fb534ef3
2 changed files with 17 additions and 1 deletions

View File

@ -79,3 +79,12 @@ func (dc *DentryCache) Len() int {
defer dc.Unlock()
return len(dc.cache)
}
func (dc *DentryCache) Clear() {
if dc == nil {
return
}
dc.Lock()
defer dc.Unlock()
dc.cache = nil
}

View File

@ -164,6 +164,13 @@ func (d *Dir) Release(ctx context.Context, req *fuse.ReleaseRequest) (err error)
log.LogDebugf("TRACE Release exit: ino(%v) name(%v)", d.info.Inode, d.name)
}()
d.dctx.Clear()
d.dcache.Clear()
ino := d.info.Inode
d.super.ic.Delete(ino)
d.super.fslock.Lock()
delete(d.super.nodeCache, ino)
d.super.fslock.Unlock()
d.super.mw.DeleteInoInfoCache(ino)
return nil
}
@ -220,7 +227,7 @@ func (d *Dir) Forget() {
}()
d.super.ic.Delete(ino)
d.dcache.Clear()
d.super.fslock.Lock()
delete(d.super.nodeCache, ino)
d.super.fslock.Unlock()