XL/heal: Should skip healing if CreateFile() failed on the part which needed healing. (#1693)

Fixes #1684
master
Krishna Srinivas 9 years ago committed by Harshavardhana
parent 537568f9f9
commit dc36594ef4
  1. 4
      xl-erasure-v1-createfile.go
  2. 27
      xl-erasure-v1-healfile.go

@ -89,10 +89,6 @@ func (xl XL) writeErasure(volume, path string, reader *io.PipeReader, wcloser *w
xl.cleanupCreateFileOps(volume, path, append(writers, metadataWriters...)...) xl.cleanupCreateFileOps(volume, path, append(writers, metadataWriters...)...)
reader.CloseWithError(err) reader.CloseWithError(err)
return return
} else if err == errVolumeNotFound {
xl.cleanupCreateFileOps(volume, path, append(writers, metadataWriters...)...)
reader.CloseWithError(err)
return
} }
createFileError++ createFileError++

@ -55,19 +55,6 @@ func (xl XL) healFile(volume string, path string) error {
} }
} }
// Check if there is atleast one part that needs to be healed.
atleastOneHeal := false
for _, healNeeded := range needsHeal {
if healNeeded {
atleastOneHeal = true
break
}
}
if !atleastOneHeal {
// Return if healing not needed anywhere.
return nil
}
// create writers for parts where healing is needed. // create writers for parts where healing is needed.
for index, healNeeded := range needsHeal { for index, healNeeded := range needsHeal {
if !healNeeded { if !healNeeded {
@ -81,6 +68,20 @@ func (xl XL) healFile(volume string, path string) error {
continue continue
} }
} }
// Check if there is atleast one part that needs to be healed.
atleastOneHeal := false
for _, healNeeded := range needsHeal {
if healNeeded {
atleastOneHeal = true
break
}
}
if !atleastOneHeal {
// Return if healing not needed anywhere.
return nil
}
var totalLeft = metadata.Stat.Size var totalLeft = metadata.Stat.Size
for totalLeft > 0 { for totalLeft > 0 {
// Figure out the right blockSize. // Figure out the right blockSize.

Loading…
Cancel
Save