erasure: healVolume err should be different from shadowed version. (#1590)

Multiple go-routines updating the same shadowed variable can
cause a data race, avoid it by using its own err variable.

Fixes #1589
This commit is contained in:
Harshavardhana
2016-05-11 01:36:09 -07:00
committed by Anand Babu (AB) Periasamy
parent 49141eb3e4
commit 72748d2073
2 changed files with 12 additions and 6 deletions
+2 -2
View File
@@ -51,11 +51,11 @@ func (xl XL) ReadFile(volume, path string, startOffset int64) (io.ReadCloser, er
// Heal in background safely, since we already have read
// quorum disks. Let the reads continue.
go func() {
if err = xl.healFile(volume, path); err != nil {
if hErr := xl.healFile(volume, path); hErr != nil {
log.WithFields(logrus.Fields{
"volume": volume,
"path": path,
}).Errorf("healFile failed with %s", err)
}).Errorf("healFile failed with %s", hErr)
return
}
}()