mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
site-repl: Fix deadlock after an IAM loading error (#14990)
Fix forgotten IAM cache lock releases when reading some data from disk/etcd Co-authored-by: Anis Elleuch <anis@min.io>
This commit is contained in:
parent
9d07cde385
commit
ccbf65c8e8
@ -3125,13 +3125,17 @@ func (c *SiteReplicationSys) SiteReplicationMetaInfo(ctx context.Context, objAPI
|
||||
}
|
||||
} else {
|
||||
globalIAMSys.store.rlock()
|
||||
if err := globalIAMSys.store.loadMappedPolicies(ctx, stsUser, false, userPolicyMap); err != nil {
|
||||
return info, errSRBackendIssue(err)
|
||||
}
|
||||
if err = globalIAMSys.store.loadMappedPolicies(ctx, regUser, false, userPolicyMap); err != nil {
|
||||
return info, errSRBackendIssue(err)
|
||||
}
|
||||
stsErr := globalIAMSys.store.loadMappedPolicies(ctx, stsUser, false, userPolicyMap)
|
||||
globalIAMSys.store.runlock()
|
||||
if stsErr != nil {
|
||||
return info, errSRBackendIssue(stsErr)
|
||||
}
|
||||
globalIAMSys.store.rlock()
|
||||
usrErr := globalIAMSys.store.loadMappedPolicies(ctx, regUser, false, userPolicyMap)
|
||||
globalIAMSys.store.runlock()
|
||||
if usrErr != nil {
|
||||
return info, errSRBackendIssue(usrErr)
|
||||
}
|
||||
}
|
||||
info.UserPolicies = make(map[string]madmin.SRPolicyMapping, len(userPolicyMap))
|
||||
for user, mp := range userPolicyMap {
|
||||
@ -3186,13 +3190,17 @@ func (c *SiteReplicationSys) SiteReplicationMetaInfo(ctx context.Context, objAPI
|
||||
}
|
||||
} else {
|
||||
globalIAMSys.store.rlock()
|
||||
if err := globalIAMSys.store.loadMappedPolicies(ctx, stsUser, true, groupPolicyMap); err != nil {
|
||||
return info, errSRBackendIssue(err)
|
||||
}
|
||||
if err := globalIAMSys.store.loadMappedPolicies(ctx, regUser, true, groupPolicyMap); err != nil {
|
||||
return info, errSRBackendIssue(err)
|
||||
}
|
||||
stsErr := globalIAMSys.store.loadMappedPolicies(ctx, stsUser, true, groupPolicyMap)
|
||||
globalIAMSys.store.runlock()
|
||||
if stsErr != nil {
|
||||
return info, errSRBackendIssue(stsErr)
|
||||
}
|
||||
globalIAMSys.store.rlock()
|
||||
userErr := globalIAMSys.store.loadMappedPolicies(ctx, regUser, true, groupPolicyMap)
|
||||
globalIAMSys.store.runlock()
|
||||
if userErr != nil {
|
||||
return info, errSRBackendIssue(userErr)
|
||||
}
|
||||
}
|
||||
|
||||
info.GroupPolicies = make(map[string]madmin.SRPolicyMapping, len(c.state.Peers))
|
||||
|
Loading…
Reference in New Issue
Block a user