Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PWX-33631: Remove global lock on getRemoteConn #2339

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 13 additions & 18 deletions csi/csi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down