From 35212b673e0ffae841f6b870609df6677f96e5a4 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Fri, 24 Jul 2020 13:16:11 -0700 Subject: [PATCH] add unformatted disk as part of the error list (#10128) these errors should be ignored for quorum error calculation to ensure that we don't prematurely return unformatted disk error as part of API calls --- cmd/erasure-bucket.go | 2 +- cmd/erasure-object.go | 2 +- cmd/object-api-common.go | 12 +++++++++--- cmd/web-handlers.go | 1 + 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/cmd/erasure-bucket.go b/cmd/erasure-bucket.go index 14b680e83..3c7f93515 100644 --- a/cmd/erasure-bucket.go +++ b/cmd/erasure-bucket.go @@ -26,7 +26,7 @@ import ( ) // list all errors that can be ignore in a bucket operation. -var bucketOpIgnoredErrs = append(baseIgnoredErrs, errDiskAccessDenied) +var bucketOpIgnoredErrs = append(baseIgnoredErrs, errDiskAccessDenied, errUnformattedDisk) // list all errors that can be ignored in a bucket metadata operation. var bucketMetadataOpIgnoredErrs = append(bucketOpIgnoredErrs, errVolumeNotFound) diff --git a/cmd/erasure-object.go b/cmd/erasure-object.go index 40e720229..f404b6f03 100644 --- a/cmd/erasure-object.go +++ b/cmd/erasure-object.go @@ -33,7 +33,7 @@ import ( ) // list all errors which can be ignored in object operations. -var objectOpIgnoredErrs = append(baseIgnoredErrs, errDiskAccessDenied) +var objectOpIgnoredErrs = append(baseIgnoredErrs, errDiskAccessDenied, errUnformattedDisk) // putObjectDir hints the bottom layer to create a new directory. func (er erasureObjects) putObjectDir(ctx context.Context, bucket, object string, writeQuorum int) error { diff --git a/cmd/object-api-common.go b/cmd/object-api-common.go index 55eb73659..411e6db4e 100644 --- a/cmd/object-api-common.go +++ b/cmd/object-api-common.go @@ -100,7 +100,9 @@ func cleanupDir(ctx context.Context, storage StorageAPI, volume, dirPath string) if !HasSuffix(entryPath, SlashSeparator) { // Delete the file entry. err := storage.DeleteFile(volume, entryPath) - logger.LogIf(ctx, err) + if err != errDiskNotFound && err != errUnformattedDisk { + logger.LogIf(ctx, err) + } return err } @@ -110,14 +112,18 @@ func cleanupDir(ctx context.Context, storage StorageAPI, volume, dirPath string) if err == errFileNotFound { return nil } else if err != nil { // For any other errors fail. - logger.LogIf(ctx, err) + if err != errDiskNotFound && err != errUnformattedDisk { + logger.LogIf(ctx, err) + } return err } // else on success.. // Entry path is empty, just delete it. if len(entries) == 0 { err = storage.DeleteFile(volume, entryPath) - logger.LogIf(ctx, err) + if err != errDiskNotFound && err != errUnformattedDisk { + logger.LogIf(ctx, err) + } return err } diff --git a/cmd/web-handlers.go b/cmd/web-handlers.go index 95269feba..f080a67a0 100644 --- a/cmd/web-handlers.go +++ b/cmd/web-handlers.go @@ -715,6 +715,7 @@ next: _, err = deleteObject(ctx, objectAPI, web.CacheAPI(), args.BucketName, objectName, r, opts) logger.LogIf(ctx, err) + continue } if authErr == errNoAuthToken {