Skip to content

Commit b515129

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

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

cmd/gpu-kubelet-plugin/allocatable.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,10 @@ func (d *PerGPUAllocatableDevices) RemoveSiblingDevices(device *AllocatableDevic
314314
}
315315
}
316316

317+
// Taints returns a copy of the device's taints to prevent data races
318+
// when being read concurrently by the ResourceSlice builder.
317319
func (d *AllocatableDevice) Taints() []resourceapi.DeviceTaint {
318-
return d.taints
320+
return slices.Clone(d.taints)
319321
}
320322

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

cmd/gpu-kubelet-plugin/nvlib.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,8 +748,6 @@ func (l deviceLib) getMigDevices(gpuInfo *GpuInfo) (map[string]*MigDeviceInfo, e
748748
gIInfo: &giInfo,
749749
ciProfileInfo: ciProfileInfo,
750750
cIInfo: &ciInfo,
751-
pcieBusID: gpuInfo.pcieBusID,
752-
pcieRootAttr: gpuInfo.pcieRootAttr,
753751
}
754752
return nil
755753
})

0 commit comments

Comments
 (0)