aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-02-28 00:34:17 -0800
committerchrislu <chris.lu@gmail.com>2022-02-28 00:34:17 -0800
commit3639fedd0196ea8640bf3bed9084f29d5b71c2ab (patch)
treefa963fb720027a8d89d77a16b7b505f84ffe051e
parent63a9d8f01d0e2fc487dc242a5dcb9649f92d963c (diff)
downloadseaweedfs-3639fedd0196ea8640bf3bed9084f29d5b71c2ab.tar.xz
seaweedfs-3639fedd0196ea8640bf3bed9084f29d5b71c2ab.zip
mount: fix fsync opened and renamed files
-rw-r--r--weed/mount/weedfs_file_sync.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/weed/mount/weedfs_file_sync.go b/weed/mount/weedfs_file_sync.go
index 8fb7c73b4..4c6dda6eb 100644
--- a/weed/mount/weedfs_file_sync.go
+++ b/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 {
// flush works at fh level
fileFullPath := fh.FullPath()
- dir, _ := fileFullPath.DirAndName()
+ dir, name := fileFullPath.DirAndName()
// send the data to the OS
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 {
return nil
}
+ entry.Name = name // this flush may be just after a rename operation
if entry.Attributes != nil {
entry.Attributes.Mime = fh.contentType