ignore io.EOF, io.ErrUnexpectedEOF on xl.meta reads in WalkDir() (#16625)

This commit is contained in:
Harshavardhana 2023-02-15 07:12:48 -08:00 committed by GitHub
parent 626a4efaad
commit 37134e42d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -2186,7 +2186,8 @@ func toAPIErrorCode(ctx context.Context, err error) (apiErr APIErrorCode) {
apiErr = ErrTransitionStorageClassNotFoundError apiErr = ErrTransitionStorageClassNotFoundError
case InvalidObjectState: case InvalidObjectState:
apiErr = ErrInvalidObjectState apiErr = ErrInvalidObjectState
case PreConditionFailed:
apiErr = ErrPreconditionFailed
case BucketQuotaExceeded: case BucketQuotaExceeded:
apiErr = ErrAdminBucketQuotaExceeded apiErr = ErrAdminBucketQuotaExceeded
case *event.ErrInvalidEventName: case *event.ErrInvalidEventName:

View File

@ -324,9 +324,14 @@ func (s *xlStorage) WalkDir(ctx context.Context, opts WalkDirOptions, wr io.Writ
case isSysErrNotDir(err): case isSysErrNotDir(err):
// skip // skip
default: default:
// 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) logger.LogIf(ctx, err)
} }
} }
}
// If directory entry left on stack, pop it now. // If directory entry left on stack, pop it now.
for len(dirStack) > 0 { for len(dirStack) > 0 {