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
This commit is contained in:
Harshavardhana
2020-07-24 13:16:11 -07:00
committed by GitHub
parent 57ff9abca2
commit 35212b673e
4 changed files with 12 additions and 5 deletions

View File

@@ -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
}