Merge pull request #53682 from gnufied/fix-lock-usage-desired-state-world

Automatic merge from submit-queue (batch tested with PRs 53678, 53677, 53682, 53673). 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>.

Make sure we use rwlocks not just RLock

We need to use of rwlock for updating the desired state of world. I think `-race` flag doesn't detects this consistently.

Fixes #53590
This commit is contained in:
Kubernetes Submit Queue 2017-10-10 18:36:05 -07:00 committed by GitHub
commit f3b6fb7add

View File

@ -336,8 +336,8 @@ func (dsw *desiredStateOfWorld) VolumeExists(
func (dsw *desiredStateOfWorld) SetMultiAttachError(
volumeName v1.UniqueVolumeName,
nodeName k8stypes.NodeName) {
dsw.RLock()
defer dsw.RUnlock()
dsw.Lock()
defer dsw.Unlock()
nodeObj, nodeExists := dsw.nodesManaged[nodeName]
if nodeExists {