Unverified Commit a6741ea7 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #45192 from cehoffman/azure_deadlock

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Prevent deadlock on azure zone fetch in presence of failure **What this PR does / why we need it**: This fixes a bug in the Zone get function for the Azure cloud provider. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # **Special notes for your reviewer**: **Release note**: ```release-note Fix deadlock in azure cloud provider zone fetching ```
parents 8583b663 04e2deeb
...@@ -44,6 +44,7 @@ type instanceInfo struct { ...@@ -44,6 +44,7 @@ type instanceInfo struct {
// GetZone returns the Zone containing the current failure zone and locality region that the program is running in // GetZone returns the Zone containing the current failure zone and locality region that the program is running in
func (az *Cloud) GetZone() (cloudprovider.Zone, error) { func (az *Cloud) GetZone() (cloudprovider.Zone, error) {
faultMutex.Lock() faultMutex.Lock()
defer faultMutex.Unlock()
if faultDomain == nil { if faultDomain == nil {
var err error var err error
faultDomain, err = fetchFaultDomain() faultDomain, err = fetchFaultDomain()
...@@ -55,7 +56,6 @@ func (az *Cloud) GetZone() (cloudprovider.Zone, error) { ...@@ -55,7 +56,6 @@ func (az *Cloud) GetZone() (cloudprovider.Zone, error) {
FailureDomain: *faultDomain, FailureDomain: *faultDomain,
Region: az.Location, Region: az.Location,
} }
faultMutex.Unlock()
return zone, nil return zone, nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment