truncate xl.meta files upon rewrites #11749)

If the destination files exist and is larger - junk data will be left at the end of the file.
This commit is contained in:
Klaus Post 2021-03-09 23:42:24 +01:00 committed by GitHub
parent 0d124095ea
commit fdc2f69218
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1619,7 +1619,7 @@ func (s *xlStorage) WriteAll(ctx context.Context, volume string, path string, b
atomic.AddInt32(&s.activeIOCount, -1)
}()
w, err := s.openFile(volume, path, os.O_CREATE|os.O_WRONLY)
w, err := s.openFile(volume, path, os.O_CREATE|os.O_WRONLY|os.O_TRUNC)
if err != nil {
return err
}