aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys/wfs.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-01-10 00:52:16 -0800
committerchrislu <chris.lu@gmail.com>2022-01-10 00:52:16 -0800
commitcbc055dc2b1cfdea16ae557780a9476b566899fe (patch)
treee45b8381abad4b03e6ab5a966f25728b8805daf4 /weed/filesys/wfs.go
parent19555385f7b99bce0e1f562f3cd4a4f440dd3d8e (diff)
downloadseaweedfs-cbc055dc2b1cfdea16ae557780a9476b566899fe.tar.xz
seaweedfs-cbc055dc2b1cfdea16ae557780a9476b566899fe.zip
mount: file fsync
fix https://github.com/chrislusf/seaweedfs/issues/2561
Diffstat (limited to 'weed/filesys/wfs.go')
-rw-r--r--weed/filesys/wfs.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go
index 127c160c4..c9a7ac0a1 100644
--- a/weed/filesys/wfs.go
+++ b/weed/filesys/wfs.go
@@ -179,6 +179,28 @@ func (wfs *WFS) AcquireHandle(file *File, uid, gid uint32) (fileHandle *FileHand
return
}
+func (wfs *WFS) Fsync(file *File, header fuse.Header) error {
+
+ inodeId := file.Id()
+
+ wfs.handlesLock.Lock()
+ existingHandle, found := wfs.handles[inodeId]
+ wfs.handlesLock.Unlock()
+
+ if found && existingHandle != nil && existingHandle.f.isOpen > 0 {
+
+ existingHandle.Add(1)
+ defer existingHandle.Done()
+
+ existingHandle.Lock()
+ defer existingHandle.Unlock()
+
+ return existingHandle.doFlush(context.Background(), header)
+ }
+
+ return nil
+}
+
func (wfs *WFS) ReleaseHandle(fullpath util.FullPath, handleId fuse.HandleID) {
wfs.handlesLock.Lock()
defer wfs.handlesLock.Unlock()