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/nametransform/diriv.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'internal/nametransform') diff --git a/internal/nametransform/diriv.go b/internal/nametransform/diriv.go index d67a5fa..1a72d2a 100644 --- a/internal/nametransform/diriv.go +++ b/internal/nametransform/diriv.go @@ -100,7 +100,10 @@ func WriteDirIV(dirfd *os.File, dir string) error { _, err = fd.Write(iv) if err != nil { fd.Close() - tlog.Warn.Printf("WriteDirIV: Write: %v", err) + // It is normal to get ENOSPC here + if !syscallcompat.IsENOSPC(err) { + tlog.Warn.Printf("WriteDirIV: Write: %v", err) + } // Delete incomplete gocryptfs.diriv file syscallcompat.Unlinkat(int(dirfd.Fd()), file, 0) return err -- cgit v1.2.3