From a84548d7eac02a718d689698db6891de08f90ec7 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Thu, 15 Sep 2016 00:41:39 +0100 Subject: [PATCH] Fix FS remove bucket regression bug (#2693) --- cmd/fs-v1.go | 14 ++++++-------- cmd/object-common.go | 3 ++- cmd/routers.go | 1 + 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cmd/fs-v1.go b/cmd/fs-v1.go index c86a482d8..6a49e9805 100644 --- a/cmd/fs-v1.go +++ b/cmd/fs-v1.go @@ -117,26 +117,24 @@ func (fs fsObjects) Shutdown() error { _, err := fs.storage.ListDir(minioMetaBucket, mpartMetaPrefix) if err != errFileNotFound { // A nil err means that multipart directory is not empty hence do not remove '.minio.sys' volume. - // A non nil err means that an unexpected error occurred - return err + // A non nil err means that an unexpected error occured + return toObjectErr(traceError(err)) } // List if there are any bucket configuration entries. _, err = fs.storage.ListDir(minioMetaBucket, bucketConfigPrefix) if err != errFileNotFound { // A nil err means that bucket config directory is not empty hence do not remove '.minio.sys' volume. - // A non nil err means that an unexpected error occurred - return err + // A non nil err means that an unexpected error occured + return toObjectErr(traceError(err)) } // Cleanup everything else. prefix := "" if err = cleanupDir(fs.storage, minioMetaBucket, prefix); err != nil { - errorIf(err, "Unable to cleanup minio meta bucket") return err } if err = fs.storage.DeleteVol(minioMetaBucket); err != nil { if err != errVolumeNotEmpty { - errorIf(err, "Unable to delete minio meta bucket %s", minioMetaBucket) - return err + return toObjectErr(traceError(err)) } } // Successful. @@ -220,7 +218,7 @@ func (fs fsObjects) DeleteBucket(bucket string) error { return toObjectErr(traceError(err), bucket) } // Cleanup all the previously incomplete multiparts. - if err := cleanupDir(fs.storage, path.Join(minioMetaBucket, mpartMetaPrefix), bucket); err != nil && err != errVolumeNotFound { + if err := cleanupDir(fs.storage, path.Join(minioMetaBucket, mpartMetaPrefix), bucket); err != nil && errorCause(err) != errVolumeNotFound { return toObjectErr(err, bucket) } return nil diff --git a/cmd/object-common.go b/cmd/object-common.go index c6243842f..fbb9a517f 100644 --- a/cmd/object-common.go +++ b/cmd/object-common.go @@ -216,7 +216,8 @@ func cleanupDir(storage StorageAPI, volume, dirPath string) error { delFunc = func(entryPath string) error { if !strings.HasSuffix(entryPath, slashSeparator) { // Delete the file entry. - return storage.DeleteFile(volume, entryPath) + err := storage.DeleteFile(volume, entryPath) + return traceError(err) } // If it's a directory, list and call delFunc() for each entry. diff --git a/cmd/routers.go b/cmd/routers.go index 7890657b6..251283e6c 100644 --- a/cmd/routers.go +++ b/cmd/routers.go @@ -62,6 +62,7 @@ func newObjectLayer(disks, ignoredDisks []string) (ObjectLayer, error) { globalShutdownCBs.AddObjectLayerCB(func() errCode { if objAPI != nil { if sErr := objAPI.Shutdown(); sErr != nil { + errorIf(err, "Unable to shutdown object API.") return exitFailure } }