aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2018-11-13 23:53:17 -0800
committerChris Lu <chris.lu@gmail.com>2018-11-13 23:53:17 -0800
commit11b0a9cb76b0228cea34d6dc353103bb4a739f50 (patch)
treea4cc905e2fb9396f9a6a575c4af002cdb914c751
parenta62adf62ca116bf95bbf22350236ab85a8c1ee42 (diff)
downloadseaweedfs-11b0a9cb76b0228cea34d6dc353103bb4a739f50.tar.xz
seaweedfs-11b0a9cb76b0228cea34d6dc353103bb4a739f50.zip
fix possible error when reusing file handles
-rw-r--r--weed/filesys/filehandle.go2
-rw-r--r--weed/filesys/wfs.go5
2 files changed, 4 insertions, 3 deletions
diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.go
index cc2c070eb..b15aa68d9 100644
--- a/weed/filesys/filehandle.go
+++ b/weed/filesys/filehandle.go
@@ -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)
- fh.f.wfs.ReleaseHandle(fuse.HandleID(fh.handle))
+ fh.f.wfs.ReleaseHandle(fh.f.fullpath(), fuse.HandleID(fh.handle))
fh.f.isOpen = false
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go
index 8103fd570..4520f2eb5 100644
--- a/weed/filesys/wfs.go
+++ b/weed/filesys/wfs.go
@@ -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
}