From 37134e42d45e91e21d65f370fbbafb9c9c0f631e Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 15 Feb 2023 07:12:48 -0800 Subject: [PATCH] ignore io.EOF, io.ErrUnexpectedEOF on xl.meta reads in WalkDir() (#16625) --- cmd/api-errors.go | 3 ++- cmd/metacache-walk.go | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cmd/api-errors.go b/cmd/api-errors.go index 3adcc1854..6ed791268 100644 --- a/cmd/api-errors.go +++ b/cmd/api-errors.go @@ -2186,7 +2186,8 @@ func toAPIErrorCode(ctx context.Context, err error) (apiErr APIErrorCode) { apiErr = ErrTransitionStorageClassNotFoundError case InvalidObjectState: apiErr = ErrInvalidObjectState - + case PreConditionFailed: + apiErr = ErrPreconditionFailed case BucketQuotaExceeded: apiErr = ErrAdminBucketQuotaExceeded case *event.ErrInvalidEventName: diff --git a/cmd/metacache-walk.go b/cmd/metacache-walk.go index dadf67ad5..d1abb15a4 100644 --- a/cmd/metacache-walk.go +++ b/cmd/metacache-walk.go @@ -324,7 +324,12 @@ func (s *xlStorage) WalkDir(ctx context.Context, opts WalkDirOptions, wr io.Writ case isSysErrNotDir(err): // skip default: - logger.LogIf(ctx, err) + // It is totally possible that xl.meta was overwritten + // while being concurrently listed at the same time in + // such scenarios the 'xl.meta' might get truncated + if !IsErrIgnored(err, io.EOF, io.ErrUnexpectedEOF) { + logger.LogIf(ctx, err) + } } }