aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys/wfs.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-10-25 09:42:47 -0700
committerChris Lu <chris.lu@gmail.com>2020-10-25 09:42:50 -0700
commit10a4a628e9305c49eb14c45fcc6b414b47b6a8e5 (patch)
tree71b7cfad0bb597e2c4547185baadfbc663b58157 /weed/filesys/wfs.go
parent46cb692d834682fd3baedc3ec36b0117faad45cb (diff)
downloadseaweedfs-10a4a628e9305c49eb14c45fcc6b414b47b6a8e5.tar.xz
seaweedfs-10a4a628e9305c49eb14c45fcc6b414b47b6a8e5.zip
refresh cached file entry from sync metadata updates
Diffstat (limited to 'weed/filesys/wfs.go')
-rw-r--r--weed/filesys/wfs.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go
index 265fc95a8..912be3c05 100644
--- a/weed/filesys/wfs.go
+++ b/weed/filesys/wfs.go
@@ -119,10 +119,12 @@ func (wfs *WFS) AcquireHandle(file *File, uid, gid uint32) (fileHandle *FileHand
defer wfs.handlesLock.Unlock()
inodeId := file.fullpath().AsInode()
- existingHandle, found := wfs.handles[inodeId]
- if found && existingHandle != nil {
- file.isOpen++
- return existingHandle
+ if file.isOpen > 0 {
+ existingHandle, found := wfs.handles[inodeId]
+ if found && existingHandle != nil {
+ file.isOpen++
+ return existingHandle
+ }
}
fileHandle = newFileHandle(file, uid, gid)