fix possible error when reusing file handles

This commit is contained in:
Chris Lu
2018-11-13 23:53:17 -08:00
parent a62adf62ca
commit 11b0a9cb76
2 changed files with 4 additions and 3 deletions

View File

@@ -99,11 +99,12 @@ func (wfs *WFS) AcquireHandle(file *File, uid, gid uint32) (fileHandle *FileHand
return
}
func (wfs *WFS) ReleaseHandle(handleId fuse.HandleID) {
func (wfs *WFS) ReleaseHandle(fullpath string, handleId fuse.HandleID) {
wfs.pathToHandleLock.Lock()
defer wfs.pathToHandleLock.Unlock()
glog.V(4).Infoln("releasing handle id", handleId, "current handles lengh", len(wfs.handles))
glog.V(4).Infof("%s releasing handle id %dcurrent handles lengh %d", fullpath, handleId, len(wfs.handles))
delete(wfs.pathToHandleIndex, fullpath)
if int(handleId) < len(wfs.handles) {
wfs.handles[int(handleId)] = nil
}