sync: fix incorrect error reported by graceful cutoff - fixes #5203

Before this change, a sync which was finished with a graceful transfer
cutoff could return "context canceled" instead of the correct error.

This fixes the problem by ignoring "context canceled" errors if we
have done a graceful stop.
This commit is contained in:
Nick Craig-Wood 2021-04-06 12:59:36 +01:00
parent 2f6afe6005
commit 563c4f76c6
1 changed files with 3 additions and 0 deletions

View File

@ -264,6 +264,9 @@ func (s *syncCopyMove) processError(err error) {
// Cancel the march and stop the pipes
s.inCancel()
}
} else if err == context.Canceled && s.inCtx.Err() != nil {
// Ignore context Canceled if we have called s.inCancel()
return
}
s.errorMu.Lock()
defer s.errorMu.Unlock()