diff options
| author | Chris Lu <chris.lu@uber.com> | 2021-04-08 19:47:31 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@uber.com> | 2021-04-08 19:47:31 -0700 |
| commit | 6deb647a8f07fe3828ce87a7cdd6c5925ea7f09e (patch) | |
| tree | d537492b30044e8b4b4526889a04ddfcdfed4e22 /weed/filesys/filehandle.go | |
| parent | b06c5b9d9907063fb4a3fddbcce1cfcc67be38d9 (diff) | |
| download | seaweedfs-6deb647a8f07fe3828ce87a7cdd6c5925ea7f09e.tar.xz seaweedfs-6deb647a8f07fe3828ce87a7cdd6c5925ea7f09e.zip | |
mount: fix possible memory leak
if many files are read repeatedly, their metadata are accumulated in memory. This fix cleared the metadata after the file is read.
Diffstat (limited to 'weed/filesys/filehandle.go')
| -rw-r--r-- | weed/filesys/filehandle.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.go index 4419888c4..57aa41b8a 100644 --- a/weed/filesys/filehandle.go +++ b/weed/filesys/filehandle.go @@ -200,6 +200,8 @@ func (fh *FileHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) err fh.Lock() defer fh.Unlock() + fh.f.clearEntry() + if fh.f.isOpen <= 0 { glog.V(0).Infof("Release reset %s open count %d => %d", fh.f.Name, fh.f.isOpen, 0) fh.f.isOpen = 0 @@ -211,7 +213,6 @@ func (fh *FileHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) err fh.f.isOpen-- fh.f.wfs.ReleaseHandle(fh.f.fullpath(), fuse.HandleID(fh.handle)) - fh.f.setReader(nil) } return nil |
