Skip to content

Commit e99bfb8

Browse files
committed
address review: return a copy of taints to avoid race conditions
Signed-off-by: Swati Gupta <swatig@nvidia.com>
1 parent e000a17 commit e99bfb8

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

cmd/gpu-kubelet-plugin/allocatable.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,10 @@ func (d AllocatableDevices) RemoveSiblingDevices(device *AllocatableDevice) {
277277
}
278278
}
279279

280+
// Taints returns a copy of the device's taints to prevent data races
281+
// when being read concurrently by the ResourceSlice builder.
280282
func (d *AllocatableDevice) Taints() []resourceapi.DeviceTaint {
281-
return d.taints
283+
return slices.Clone(d.taints)
282284
}
283285

284286
// AddOrUpdateTaint adds a new taint or updates an existing one with the same

0 commit comments

Comments
 (0)