aboutsummaryrefslogtreecommitdiff
path: root/weed/mount/filehandle.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/mount/filehandle.go')
-rw-r--r--weed/mount/filehandle.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/weed/mount/filehandle.go b/weed/mount/filehandle.go
index 7281ede66..b6ec3d2da 100644
--- a/weed/mount/filehandle.go
+++ b/weed/mount/filehandle.go
@@ -8,16 +8,18 @@ import (
"golang.org/x/exp/slices"
"golang.org/x/sync/semaphore"
"math"
+ "sync"
)
type FileHandleId uint64
type FileHandle struct {
- fh FileHandleId
- counter int64
- entry *LockedEntry
- inode uint64
- wfs *WFS
+ fh FileHandleId
+ counter int64
+ entry *LockedEntry
+ entryLock sync.Mutex
+ inode uint64
+ wfs *WFS
// cache file has been written to
dirtyMetadata bool
@@ -69,6 +71,8 @@ func (fh *FileHandle) UpdateEntry(fn func(entry *filer_pb.Entry)) *filer_pb.Entr
}
func (fh *FileHandle) AddChunks(chunks []*filer_pb.FileChunk) {
+ fh.entryLock.Lock()
+ defer fh.entryLock.Unlock()
if fh.entry == nil {
return