mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
fix possible error when reusing file handles
This commit is contained in:
parent
a62adf62ca
commit
11b0a9cb76
|
@ -163,7 +163,7 @@ func (fh *FileHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) err
|
||||||
|
|
||||||
glog.V(4).Infof("%v release fh %d", fh.f.fullpath(), fh.handle)
|
glog.V(4).Infof("%v release fh %d", fh.f.fullpath(), fh.handle)
|
||||||
|
|
||||||
fh.f.wfs.ReleaseHandle(fuse.HandleID(fh.handle))
|
fh.f.wfs.ReleaseHandle(fh.f.fullpath(), fuse.HandleID(fh.handle))
|
||||||
|
|
||||||
fh.f.isOpen = false
|
fh.f.isOpen = false
|
||||||
|
|
||||||
|
|
|
@ -99,11 +99,12 @@ func (wfs *WFS) AcquireHandle(file *File, uid, gid uint32) (fileHandle *FileHand
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wfs *WFS) ReleaseHandle(handleId fuse.HandleID) {
|
func (wfs *WFS) ReleaseHandle(fullpath string, handleId fuse.HandleID) {
|
||||||
wfs.pathToHandleLock.Lock()
|
wfs.pathToHandleLock.Lock()
|
||||||
defer wfs.pathToHandleLock.Unlock()
|
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) {
|
if int(handleId) < len(wfs.handles) {
|
||||||
wfs.handles[int(handleId)] = nil
|
wfs.handles[int(handleId)] = nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue