From bc99fa0c359306666d8941062f493a06cfccdddd Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Sun, 10 Jan 2021 14:19:44 +0000 Subject: [PATCH] fix: account creation lock issue --- pkg/azurefile/controllerserver.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/azurefile/controllerserver.go b/pkg/azurefile/controllerserver.go index 847dcb4052..2bf49c2f7e 100644 --- a/pkg/azurefile/controllerserver.go +++ b/pkg/azurefile/controllerserver.go @@ -210,8 +210,6 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) if len(req.GetSecrets()) == 0 && accountName == "" { lockKey := sku + accountKind + resourceGroup + location d.volLockMap.LockEntry(lockKey) - defer d.volLockMap.UnlockEntry(lockKey) - err = wait.ExponentialBackoff(d.cloud.RequestBackoff(), func() (bool, error) { var retErr error accountName, accountKey, retErr = d.cloud.EnsureStorageAccount(accountOptions, fileShareAccountNamePrefix) @@ -221,6 +219,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) } return true, retErr }) + d.volLockMap.UnlockEntry(lockKey) if err != nil { return nil, status.Errorf(codes.Internal, "failed to ensure storage account: %v", err) }