Browse Source

mount: fix fsync opened and renamed files

pull/2727/head
chrislu 3 years ago
parent
commit
3639fedd01
  1. 3
      weed/mount/weedfs_file_sync.go

3
weed/mount/weedfs_file_sync.go

@ -96,7 +96,7 @@ func (wfs *WFS) Fsync(cancel <-chan struct{}, in *fuse.FsyncIn) (code fuse.Statu
func (wfs *WFS) doFlush(fh *FileHandle, uid, gid uint32) fuse.Status { func (wfs *WFS) doFlush(fh *FileHandle, uid, gid uint32) fuse.Status {
// flush works at fh level // flush works at fh level
fileFullPath := fh.FullPath() fileFullPath := fh.FullPath()
dir, _ := fileFullPath.DirAndName()
dir, name := fileFullPath.DirAndName()
// send the data to the OS // send the data to the OS
glog.V(4).Infof("doFlush %s fh %d", fileFullPath, fh.handle) glog.V(4).Infof("doFlush %s fh %d", fileFullPath, fh.handle)
@ -115,6 +115,7 @@ func (wfs *WFS) doFlush(fh *FileHandle, uid, gid uint32) fuse.Status {
if entry == nil { if entry == nil {
return nil return nil
} }
entry.Name = name // this flush may be just after a rename operation
if entry.Attributes != nil { if entry.Attributes != nil {
entry.Attributes.Mime = fh.contentType entry.Attributes.Mime = fh.contentType

Loading…
Cancel
Save