From df7eee523b8d550477bae8ee92804c83d88457a8 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Thu, 23 Jul 2020 21:09:40 -0700 Subject: [PATCH] FUSE: implement dir fsync fix https://github.com/chrislusf/seaweedfs/issues/1398 --- weed/filesys/dir.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/weed/filesys/dir.go b/weed/filesys/dir.go index 9ef74a95c..8454e51aa 100644 --- a/weed/filesys/dir.go +++ b/weed/filesys/dir.go @@ -27,6 +27,7 @@ type Dir struct { var _ = fs.Node(&Dir{}) var _ = fs.NodeCreater(&Dir{}) var _ = fs.NodeMkdirer(&Dir{}) +var _ = fs.NodeFsyncer(&Dir{}) var _ = fs.NodeRequestLookuper(&Dir{}) var _ = fs.HandleReadDirAller(&Dir{}) var _ = fs.NodeRemover(&Dir{}) @@ -90,6 +91,14 @@ func (dir *Dir) setRootDirAttributes(attr *fuse.Attr) { attr.BlockSize = 1024 * 1024 } +func (dir *Dir) Fsync(ctx context.Context, req *fuse.FsyncRequest) error { + // fsync works at OS level + // write the file chunks to the filerGrpcAddress + glog.V(3).Infof("dir %s fsync %+v", dir.FullPath(), req) + + return nil +} + func (dir *Dir) newFile(name string, entry *filer_pb.Entry) fs.Node { return dir.wfs.fsNodeCache.EnsureFsNode(util.NewFullPath(dir.FullPath(), name), func() fs.Node { return &File{