diff --git a/vfs/file.go b/vfs/file.go index eec001b86..a20c6d525 100644 --- a/vfs/file.go +++ b/vfs/file.go @@ -601,6 +601,12 @@ func (f *File) Truncate(size int64) (err error) { } return err } + + // If no writers, and size is already correct then all done + if f.o.Size() == size { + return nil + } + fs.Debugf(f.o, "Truncating file") // Otherwise if no writers then truncate the file by opening