mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-18 04:54:54 +00:00
Merge pull request #134379 from liggitt/gc-race
Lock all mutable fields when printing gc node
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user