fix: remove auto-close GetObjectReader (#12009)

locks can get relinquished when Read() sees io.EOF
leading to prematurely closing of the readers

concurrent writes on the same object can have
undesired consequences here when these locks
are relinquished.
This commit is contained in:
Harshavardhana
2021-04-07 13:29:27 -07:00
committed by GitHub
parent 48c5e7e5b6
commit 4223ebab8d
3 changed files with 13 additions and 9 deletions

View File

@@ -817,13 +817,7 @@ func (g *GetObjectReader) Close() error {
// Read - to implement Reader interface.
func (g *GetObjectReader) Read(p []byte) (n int, err error) {
n, err = g.pReader.Read(p)
if err != nil {
// Calling code may not Close() in case of error, so
// we ensure it.
g.Close()
}
return
return g.pReader.Read(p)
}
//SealMD5CurrFn seals md5sum with object encryption key and returns sealed