From 472fa4a6ca4074b4c80e6b7127cabfeede1d5c7c Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 28 Feb 2017 18:00:24 -0800 Subject: [PATCH] api: Multi object delete should be protected. (#3814) Add missing protection from deleting multiple objects in parallel. Currently we are deleting objects without proper locking through this API. This can cause significant amount of races. --- cmd/bucket-handlers.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/bucket-handlers.go b/cmd/bucket-handlers.go index 96a6971c0..0f8ef0151 100644 --- a/cmd/bucket-handlers.go +++ b/cmd/bucket-handlers.go @@ -277,7 +277,11 @@ func (api objectAPIHandlers) DeleteMultipleObjectsHandler(w http.ResponseWriter, for index, object := range deleteObjects.Objects { wg.Add(1) go func(i int, obj ObjectIdentifier) { + objectLock := globalNSMutex.NewNSLock(bucket, obj.ObjectName) + objectLock.Lock() + defer objectLock.Unlock() defer wg.Done() + dErr := objectAPI.DeleteObject(bucket, obj.ObjectName) if dErr != nil { dErrs[i] = dErr