mirror of
https://github.com/minio/minio
synced 2024-09-05 16:26:28 +00:00
Fix FS remove bucket regression bug (#2693)
This commit is contained in:
parent
19e01ceb19
commit
a84548d7ea
14
cmd/fs-v1.go
14
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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue