From cc1276ce6fb3f88abaf641ea0c758cf3f10c5595 Mon Sep 17 00:00:00 2001 From: Grant Griffiths Date: Thu, 14 Sep 2023 16:43:30 -0700 Subject: [PATCH] PWX-33631: Remove global lock on getRemoteConn (#2339) Signed-off-by: Grant Griffiths --- csi/csi.go | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/csi/csi.go b/csi/csi.go index 5c5bf739f..64b358c69 100644 --- a/csi/csi.go +++ b/csi/csi.go @@ -83,21 +83,19 @@ type OsdCsiServer struct { csi.IdentityServer *grpcserver.GrpcServer - cloudBackupClient func(cc grpc.ClientConnInterface) api.OpenStorageCloudBackupClient - specHandler spec.SpecHandler - driver volume.VolumeDriver - cluster cluster.Cluster - sdkUds string - sdkPort string - conn *grpc.ClientConn - roundRobinBalancer loadbalancer.Balancer - nextCreateNodeNumber int - mu sync.Mutex - csiDriverName string - allowInlineVolumes bool - stopCleanupCh chan bool - config *OsdCsiServerConfig - autoRecoverStopCh chan struct{} + cloudBackupClient func(cc grpc.ClientConnInterface) api.OpenStorageCloudBackupClient + specHandler spec.SpecHandler + driver volume.VolumeDriver + cluster cluster.Cluster + sdkUds string + sdkPort string + conn *grpc.ClientConn + mu sync.Mutex + csiDriverName string + allowInlineVolumes bool + roundRobinBalancer loadbalancer.Balancer + config *OsdCsiServerConfig + autoRecoverStopCh chan struct{} } // NewOsdCsiServer creates a gRPC CSI complient server on the @@ -163,9 +161,6 @@ func (s *OsdCsiServer) getConn() (*grpc.ClientConn, error) { } func (s *OsdCsiServer) getRemoteConn(ctx context.Context) (*grpc.ClientConn, error) { - s.mu.Lock() - defer s.mu.Unlock() - remoteConn, _, err := s.roundRobinBalancer.GetRemoteNodeConnection(ctx) return remoteConn, err }