mount: file fsync
fix https://github.com/chrislusf/seaweedfs/issues/2561
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user