aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys/filehandle.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-01-23 21:59:58 -0800
committerChris Lu <chris.lu@gmail.com>2020-01-23 21:59:58 -0800
commitc936a12afad1632bbc9a3d72b4723ed86da81c33 (patch)
tree1b9b551ed2ecf6e254a6fd803c504026990b1b19 /weed/filesys/filehandle.go
parentc2e589f202b84b5beb98f1f5c243cc38b58f232b (diff)
downloadseaweedfs-c936a12afad1632bbc9a3d72b4723ed86da81c33.tar.xz
seaweedfs-c936a12afad1632bbc9a3d72b4723ed86da81c33.zip
mount: update the file size so file Attr() can read
if file Attr() during file writes, the OS, at least for Mac, may try to resend the data to write, which usually are empty.
Diffstat (limited to 'weed/filesys/filehandle.go')
-rw-r--r--weed/filesys/filehandle.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.go
index c3f06ae8a..bee153cc5 100644
--- a/weed/filesys/filehandle.go
+++ b/weed/filesys/filehandle.go
@@ -102,6 +102,8 @@ func (fh *FileHandle) Write(ctx context.Context, req *fuse.WriteRequest, resp *f
// write the request to volume servers
+ fh.f.entry.Attributes.FileSize = uint64(max(req.Offset+int64(len(req.Data)), int64(fh.f.entry.Attributes.FileSize)))
+
chunks, err := fh.dirtyPages.AddPage(ctx, req.Offset, req.Data)
if err != nil {
glog.Errorf("%+v/%v write fh %d: [%d,%d): %v", fh.f.dir.Path, fh.f.Name, fh.handle, req.Offset, req.Offset+int64(len(req.Data)), err)