xl/heal: Make healFile non-blocking for StatFile and ReadFile. (#1399)

Fixes #1355
This commit is contained in:
Harshavardhana
2016-04-27 15:10:19 -07:00
parent b51bef85e6
commit 5fffd558d0
3 changed files with 25 additions and 18 deletions

View File

@@ -536,13 +536,16 @@ func (xl XL) StatFile(volume, path string) (FileInfo, error) {
}
if heal {
if err = xl.healFile(volume, path); err != nil {
log.WithFields(logrus.Fields{
"volume": volume,
"path": path,
}).Errorf("healFile failed with %s", err)
return FileInfo{}, err
}
// Heal in background safely, since we already have read quorum disks.
go func() {
if err = xl.healFile(volume, path); err != nil {
log.WithFields(logrus.Fields{
"volume": volume,
"path": path,
}).Errorf("healFile failed with %s", err)
return
}
}()
}
// Extract metadata.