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

fix race condition issue when detaching azure disk #60183

Merged
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+5 −1
Diff settings

Always

Just for now

@@ -268,7 +268,7 @@ func (d *azureDiskDetacher) Detach(diskURI string, nodeName types.NodeName) erro
return fmt.Errorf("invalid disk to detach: %q", diskURI)
}

_, err := d.cloud.InstanceID(context.TODO(), nodeName)
instanceid, err := d.cloud.InstanceID(context.TODO(), nodeName)

This comment has been minimized.

Copy link
@brendandburns

brendandburns Feb 22, 2018

Contributor

context.TODO() seems like a mistake here? is there a context we can attach to?

This comment has been minimized.

Copy link
@andyzhangx

andyzhangx Feb 22, 2018

Author Member

@brendanburns it's related to #59287, there is some future work item for context.TODO()

if err != nil {
glog.Warningf("no instance id for node %q, skip detaching (%v)", nodeName, err)
return nil
@@ -280,6 +280,10 @@ func (d *azureDiskDetacher) Detach(diskURI string, nodeName types.NodeName) erro
if err != nil {
return err
}

getLunMutex.LockKey(instanceid)
defer getLunMutex.UnlockKey(instanceid)

err = diskController.DetachDiskByName("", diskURI, nodeName)
if err != nil {
glog.Errorf("failed to detach azure disk %q, err %v", diskURI, err)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.