Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion packages/orchestrator/internal/sandbox/nbd/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,23 @@
// Get a free device slot.
func (d *DevicePool) getFreeDeviceSlot() (*DeviceSlot, error) {
start := uint32(0)
wrapped := false

for {
slot, cleanup, ok := d.getMaybeEmptySlot(start)

if !ok {
cleanup()

return nil, NoFreeSlotsError{}
// Already wrapped around once, no free slots in the entire range
if wrapped {
return nil, NoFreeSlotsError{}
}

// Reached the end for the first time, wrap around and scan from the beginning
wrapped = true
start = 0
continue

Check failure on line 246 in packages/orchestrator/internal/sandbox/nbd/pool.go

View workflow job for this annotation

GitHub Actions / lint / golangci-lint (/home/runner/work/infra/infra/packages/orchestrator)

continue with no blank line before (nlreturn)
}

free, err := d.isDeviceFree(slot)
Expand Down
Loading