diff --git a/cmd/erasure-server-pool.go b/cmd/erasure-server-pool.go index 0c4f14d58..4796c64f0 100644 --- a/cmd/erasure-server-pool.go +++ b/cmd/erasure-server-pool.go @@ -1848,7 +1848,15 @@ func (z *erasureServerPools) HealObjects(ctx context.Context, bucket, prefix str } wg.Wait() }() - return <-errCh + var err error + for e := range errCh { + // Save first non-nil error. + if e != nil && err != nil { + err = e + cancel() + } + } + return err } func (z *erasureServerPools) HealObject(ctx context.Context, bucket, object, versionID string, opts madmin.HealOpts) (madmin.HealResultItem, error) {