From d610578d843484cba503f5d11b923b09c96a2d35 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 17 May 2021 16:50:47 -0700 Subject: [PATCH] fix: de-couple IAM migration and loading context from lock context (#12312) fixes #12307 --- cmd/iam.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/iam.go b/cmd/iam.go index 55be1cddd..cdd5ad8e4 100644 --- a/cmd/iam.go +++ b/cmd/iam.go @@ -624,7 +624,7 @@ func (sys *IAMSys) Init(ctx context.Context, objAPI ObjectLayer) { // **** WARNING **** // Migrating to encrypted backend on etcd should happen before initialization of // IAM sub-system, make sure that we do not move the above codeblock elsewhere. - if err := migrateIAMConfigsEtcdToEncrypted(lkctx.Context(), globalEtcdClient); err != nil { + if err := migrateIAMConfigsEtcdToEncrypted(retryCtx, globalEtcdClient); err != nil { txnLk.Unlock(lkctx.Cancel) logger.LogIf(ctx, fmt.Errorf("Unable to decrypt an encrypted ETCD backend for IAM users and policies: %w", err)) logger.LogIf(ctx, errors.New("IAM sub-system is partially initialized, some users may not be available")) @@ -638,7 +638,7 @@ func (sys *IAMSys) Init(ctx context.Context, objAPI ObjectLayer) { } // Migrate IAM configuration, if necessary. - if err := sys.doIAMConfigMigration(lkctx.Context()); err != nil { + if err := sys.doIAMConfigMigration(retryCtx); err != nil { txnLk.Unlock(lkctx.Cancel) if configRetriableErrors(err) { logger.Info("Waiting for all MinIO IAM sub-system to be initialized.. possible cause (%v)", err) @@ -655,7 +655,7 @@ func (sys *IAMSys) Init(ctx context.Context, objAPI ObjectLayer) { } for { - if err := sys.store.loadAll(ctx, sys); err != nil { + if err := sys.store.loadAll(retryCtx, sys); err != nil { if configRetriableErrors(err) { logger.Info("Waiting for all MinIO IAM sub-system to be initialized.. possible cause (%v)", err) time.Sleep(time.Duration(r.Float64() * float64(5*time.Second)))