fix: do not log concurrently when multiple disks return errors (#15044)

since the values inside 'context' are mutated internally by
logger, make sure to log serially upon errors not concurrently.
This commit is contained in:
Harshavardhana
2022-06-06 15:15:11 -07:00
committed by GitHub
parent 31c4fdbf79
commit df9eeb7f8f
3 changed files with 29 additions and 24 deletions

View File

@@ -2066,7 +2066,7 @@ func skipAccessChecks(volume string) (ok bool) {
// RenameData - rename source path to destination path atomically, metadata and data directory.
func (s *xlStorage) RenameData(ctx context.Context, srcVolume, srcPath string, fi FileInfo, dstVolume, dstPath string) (err error) {
defer func() {
if err != nil && !contextCanceled(ctx) {
if err != nil && !contextCanceled(ctx) && !errors.Is(err, errFileNotFound) {
// Only log these errors if context is not yet canceled.
logger.LogIf(ctx, fmt.Errorf("srcVolume: %s, srcPath: %s, dstVolume: %s:, dstPath: %s - error %v",
srcVolume, srcPath,