From 03923947c4621f9f40bab8b5e15df94080cabdfe Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Fri, 16 Feb 2018 20:16:48 -0800 Subject: [PATCH] Fix delete bucket policies properly (#5540) There was bug in previous PR where deleteBucketMetadata() was never called, fix it correctly. --- cmd/xl-sets.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/cmd/xl-sets.go b/cmd/xl-sets.go index 59ed1bf62..fb784f448 100644 --- a/cmd/xl-sets.go +++ b/cmd/xl-sets.go @@ -345,10 +345,12 @@ func (s *xlSets) MakeBucketWithLocation(bucket, location string) error { errs := g.Wait() // Upon even a single write quorum error we undo all previously created buckets. for _, err := range errs { - if _, ok := err.(InsufficientWriteQuorum); ok { - undoMakeBucketSets(bucket, s.sets, errs) + if err != nil { + if _, ok := err.(InsufficientWriteQuorum); ok { + undoMakeBucketSets(bucket, s.sets, errs) + } + return err } - return err } // Success. @@ -481,10 +483,12 @@ func (s *xlSets) DeleteBucket(bucket string) error { // For any write quorum failure, we undo all the delete buckets operation // by creating all the buckets again. for _, err := range errs { - if _, ok := err.(InsufficientWriteQuorum); ok { - undoDeleteBucketSets(bucket, s.sets, errs) + if err != nil { + if _, ok := err.(InsufficientWriteQuorum); ok { + undoDeleteBucketSets(bucket, s.sets, errs) + } + return err } - return err } // Delete all bucket metadata.