mirror of
https://github.com/minio/minio.git
synced 2026-02-04 18:00:15 -05:00
- When modifying notification configuration - When modifying listener configuration - When modifying policy configuration With this change we also stop early checking if the bucket exists, since that uses a Read-lock and causes a deadlock due to the outer Write-lock.
This commit is contained in:
committed by
Harshavardhana
parent
0905398459
commit
3977d6b7bd
@@ -200,12 +200,20 @@ func (api objectAPIHandlers) PutBucketPolicyHandler(w http.ResponseWriter, r *ht
|
||||
// persists it to storage, and notify nodes in the cluster about the
|
||||
// change. In-memory state is updated in response to the notification.
|
||||
func persistAndNotifyBucketPolicyChange(bucket string, pCh policyChange, objAPI ObjectLayer) error {
|
||||
// FIXME: Race exists between the bucket existence check and
|
||||
// then updating the bucket policy.
|
||||
// Verify if bucket actually exists. FIXME: Ideally this check
|
||||
// should not be used but is kept here to error out for
|
||||
// invalid and non-existent buckets.
|
||||
if err := isBucketExist(bucket, objAPI); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Acquire a write lock on bucket before modifying its
|
||||
// configuration.
|
||||
opsID := getOpsID()
|
||||
nsMutex.Lock(bucket, "", opsID)
|
||||
// Release lock after notifying peers
|
||||
defer nsMutex.Unlock(bucket, "", opsID)
|
||||
|
||||
if pCh.IsRemove {
|
||||
if err := removeBucketPolicy(bucket, objAPI); err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user