mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-06-11 09:53:38 -04:00
Lock all mutable fields when printing gc node
This commit is contained in:
parent
6bb0bd55a3
commit
6d3d7553fb
1 changed files with 8 additions and 1 deletions
|
|
@ -206,10 +206,17 @@ func ownerReferenceMatchesCoordinates(a, b metav1.OwnerReference) bool {
|
|||
}
|
||||
|
||||
// String renders node as a string using fmt. Acquires a read lock to ensure the
|
||||
// reflective dump of dependents doesn't race with any concurrent writes.
|
||||
// reflective dump of fields doesn't race with any concurrent writes.
|
||||
func (n *node) String() string {
|
||||
n.beingDeletedLock.RLock()
|
||||
defer n.beingDeletedLock.RUnlock()
|
||||
|
||||
n.virtualLock.RLock()
|
||||
defer n.virtualLock.RUnlock()
|
||||
|
||||
n.dependentsLock.RLock()
|
||||
defer n.dependentsLock.RUnlock()
|
||||
|
||||
return fmt.Sprintf("%#v", n)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue