mirror of
https://github.com/minio/minio.git
synced 2025-01-12 07:23:23 -05:00
Close replica channel only once (#10542)
Also enforce s3:GetReplicationConfiguration permission check as a bucket level resource.
This commit is contained in:
parent
a4006e23a0
commit
4c54ed8748
@ -87,7 +87,7 @@ func mustReplicateWeb(ctx context.Context, r *http.Request, bucket, object strin
|
|||||||
|
|
||||||
// mustReplicate returns true if object meets replication criteria.
|
// mustReplicate returns true if object meets replication criteria.
|
||||||
func mustReplicate(ctx context.Context, r *http.Request, bucket, object string, meta map[string]string, replStatus string) bool {
|
func mustReplicate(ctx context.Context, r *http.Request, bucket, object string, meta map[string]string, replStatus string) bool {
|
||||||
if s3Err := isPutActionAllowed(getRequestAuthType(r), bucket, object, r, iampolicy.GetReplicationConfigurationAction); s3Err != ErrNone {
|
if s3Err := isPutActionAllowed(getRequestAuthType(r), bucket, "", r, iampolicy.GetReplicationConfigurationAction); s3Err != ErrNone {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return mustReplicater(ctx, r, bucket, object, meta, replStatus)
|
return mustReplicater(ctx, r, bucket, object, meta, replStatus)
|
||||||
@ -304,9 +304,14 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func newReplicationState() *replicationState {
|
func newReplicationState() *replicationState {
|
||||||
return &replicationState{
|
rs := &replicationState{
|
||||||
replicaCh: make(chan ObjectInfo, globalReplicationConcurrent*2),
|
replicaCh: make(chan ObjectInfo, globalReplicationConcurrent*2),
|
||||||
}
|
}
|
||||||
|
go func() {
|
||||||
|
<-GlobalContext.Done()
|
||||||
|
close(rs.replicaCh)
|
||||||
|
}()
|
||||||
|
return rs
|
||||||
}
|
}
|
||||||
|
|
||||||
// addWorker creates a new worker to process tasks
|
// addWorker creates a new worker to process tasks
|
||||||
@ -316,7 +321,6 @@ func (r *replicationState) addWorker(ctx context.Context, objectAPI ObjectLayer)
|
|||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
close(r.replicaCh)
|
|
||||||
return
|
return
|
||||||
case oi, ok := <-r.replicaCh:
|
case oi, ok := <-r.replicaCh:
|
||||||
if !ok {
|
if !ok {
|
||||||
|
Loading…
Reference in New Issue
Block a user