From c70df522d2a78f3152fa61511bed9fafa7c495a3 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 15 Jul 2018 14:14:12 +0200 Subject: fusefrontend: doWrite: delete file header if first write fails xfstests generic/083 fills the filesystem almost completely while running fsstress in parallel. In fsck, these would show up: readFileID 2580: incomplete file, got 18 instead of 19 bytes This could happen when writing the file header works, but writing the actual data fails. Now we kill the header again by truncating the file to zero. --- internal/fusefrontend/file_allocate_truncate.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'internal/fusefrontend/file_allocate_truncate.go') diff --git a/internal/fusefrontend/file_allocate_truncate.go b/internal/fusefrontend/file_allocate_truncate.go index 74c51a7..81ac8d3 100644 --- a/internal/fusefrontend/file_allocate_truncate.go +++ b/internal/fusefrontend/file_allocate_truncate.go @@ -144,7 +144,7 @@ func (f *File) Truncate(newSize uint64) fuse.Status { var data []byte if lastBlockLen > 0 { var status fuse.Status - data, status = f.doRead(nil, plainOff, lastBlockLen) + data, status = f.doRead(nil, plainOff, lastBlockLen, false) if status != fuse.OK { tlog.Warn.Printf("Truncate: shrink doRead returned error: %v", err) return status -- cgit v1.2.3