fs/XL: Return IncompleteBody{} error for short writes (#2228)

This commit is contained in:
Krishnan Parthasarathi
2016-07-18 19:06:48 -07:00
committed by Harshavardhana
parent 27a5b61f40
commit 5cc9e4e214
9 changed files with 93 additions and 48 deletions
+8
View File
@@ -385,6 +385,14 @@ func (xl xlObjects) PutObjectPart(bucket, object, uploadID string, partID int, s
// Erasure code data and write across all disks.
sizeWritten, checkSums, err := erasureCreateFile(onlineDisks, minioMetaBucket, tmpPartPath, teeReader, xlMeta.Erasure.BlockSize, xl.dataBlocks, xl.parityBlocks, xl.writeQuorum)
if err != nil {
return "", toObjectErr(err, minioMetaBucket, tmpPartPath)
}
// Should return IncompleteBody{} error when reader has fewer bytes
// than specified in request header.
if sizeWritten < size {
return "", IncompleteBody{}
}
// For size == -1, perhaps client is sending in chunked encoding
// set the size as size that was actually written.