XL/erasure: fix for skipping 0 padding. (#1737)

Fixes #1736
This commit is contained in:
Krishna Srinivas
2016-05-24 20:14:32 +05:30
committed by Harshavardhana
parent 6d84e84b3c
commit b38b9fea79
3 changed files with 44 additions and 39 deletions
+3 -1
View File
@@ -37,6 +37,8 @@ func (xl xlObjects) GetObject(bucket, object string, startOffset int64) (io.Read
return nil, toObjectErr(err, bucket, object)
}
totalObjectSize := xlMeta.Stat.Size // Total object size.
// Hold a read lock once more which can be released after the following go-routine ends.
// We hold RLock once more because the current function would return before the go routine below
// executes and hence releasing the read lock (because of defer'ed nsMutex.RUnlock() call).
@@ -45,7 +47,7 @@ func (xl xlObjects) GetObject(bucket, object string, startOffset int64) (io.Read
defer nsMutex.RUnlock(bucket, object)
for ; partIndex < len(xlMeta.Parts); partIndex++ {
part := xlMeta.Parts[partIndex]
r, err := xl.erasureDisk.ReadFile(bucket, pathJoin(object, part.Name), offset)
r, err := xl.erasureDisk.ReadFile(bucket, pathJoin(object, part.Name), offset, totalObjectSize)
if err != nil {
fileWriter.CloseWithError(err)
return