mirror of
https://github.com/pgsty/minio.git
synced 2026-10-09 19:25:59 +03:00
Fix PUT bucket notification deadlocks (#5734)
This PR fixes two different variant of deadlocks in notification. - holding write lock on the bucket competing with read lock - holding competing locks on read/save notification config
This commit is contained in:
committed by
Dee Koder
parent
35b3913d22
commit
ef61b36c5a
@@ -138,14 +138,6 @@ func (api objectAPIHandlers) PutBucketNotificationHandler(w http.ResponseWriter,
|
||||
return
|
||||
}
|
||||
|
||||
// Acquire a write lock on bucket before modifying its configuration.
|
||||
bucketLock := globalNSMutex.NewNSLock(bucketName, "")
|
||||
if err = bucketLock.GetLock(globalOperationTimeout); err != nil {
|
||||
writeErrorResponse(w, toAPIErrorCode(err), r.URL)
|
||||
return
|
||||
}
|
||||
defer bucketLock.Unlock()
|
||||
|
||||
if err = saveNotificationConfig(objectAPI, bucketName, config); err != nil {
|
||||
writeErrorResponse(w, toAPIErrorCode(err), r.URL)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user