aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys/filehandle.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2019-06-20 21:58:35 -0700
committerChris Lu <chris.lu@gmail.com>2019-06-20 21:58:35 -0700
commit4b0f084b5db4637817ef7980d3329eef3e4dba02 (patch)
tree21f346197f46f903a84a371274c43944afb7dcb2 /weed/filesys/filehandle.go
parenteebc44cce3f767d4a1785734c83f0a9f847e1c9b (diff)
downloadseaweedfs-4b0f084b5db4637817ef7980d3329eef3e4dba02.tar.xz
seaweedfs-4b0f084b5db4637817ef7980d3329eef3e4dba02.zip
delete chunks only when file writing is successful
Diffstat (limited to 'weed/filesys/filehandle.go')
-rw-r--r--weed/filesys/filehandle.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.go
index 60c50c95c..577403cef 100644
--- a/weed/filesys/filehandle.go
+++ b/weed/filesys/filehandle.go
@@ -160,12 +160,13 @@ func (fh *FileHandle) Flush(ctx context.Context, req *fuse.FlushRequest) error {
chunks, garbages := filer2.CompactFileChunks(fh.f.entry.Chunks)
fh.f.entry.Chunks = chunks
// fh.f.entryViewCache = nil
- fh.f.wfs.deleteFileChunks(ctx, garbages)
if _, err := client.CreateEntry(ctx, request); err != nil {
return fmt.Errorf("update fh: %v", err)
}
+ fh.f.wfs.deleteFileChunks(ctx, garbages)
+
return nil
})
}