Skip to content

pool: a volume run no longer checks that it is the registered run - #686

Merged
CMGS merged 1 commit into
mainfrom
pool/volume-run-check
Dec 2, 2026
Merged

CMGS merged 1 commit into
mainfrom
pool/volume-run-check

Conversation

@CMGS

@CMGS CMGS commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

What

A cut, no behaviour change: a volume change (and the remount after a guest reboot) no longer checks that its run is the one registered for the claim.

  • checkVolumeRunLocked: the m.volumeRuns[sb] != run case is gone, and with it the run parameter of checkVolumeRunLocked, checkVolumeRun and detachVolumeRun.
  • commitVolumeRun: the same comparison is gone.
  • ownsRunLocked is deleted; its three callers (settleReboot, recordVolumeError, clearVolumeError) call holdsLocked and the two error functions lose their run parameter.
  • sandboxd/pool/CHECKLIST.md: the settleReboot row names holdsLocked.

Production lines: +25 -34 in volume_mutation.go and reboot.go, net -9. Tests: two call sites drop the argument; no assertion changes.

Why it could not fire

  • m.volumeRuns is made once and never reassigned. It has one insert, in beginVolumeRun, under m.mu, only when the claim has no entry and after the caller waited out the active run; and one delete, in finishVolumeRun, in the same m.mu hold that closes the run's done.
  • finishVolumeRun is called only by the run's owner, in a defer set after a successful begin (changeVolumes, settleReboot).
  • Every function that takes a run is called synchronously inside that owner, between the begin and the deferred finish, with the run the begin returned. No callee keeps the run, starts a goroutine with it or returns it. cancelVolumeRun, the one outside reader, cancels the run and copies its holds; it does not write the map.
  • A resize swaps the claim's record. The old and the new record are different map keys, so a run on each can exist at once, and each owner still finds its own run under its own key. The old owner is refused by heldErrLocked (ErrReplaced), which ran before the deleted comparison in both functions.

So the entry under the caller's own record was always the caller's run, and a released or replaced record is refused by heldErrLocked and holdsLocked as before.

Evidence

  • Probe, not committed: the three comparisons replaced by a panic on the side that cannot happen; go test -race ./pool/ ./server/ passed with no panic.
  • An independent read, briefed to find a counterexample (another writer of the map, a call outside the owner's span, two owners across a record swap, a finish that deletes another owner's entry, a visible change of error): none found.
  • No test pinned the deleted comparison: no test writes m.volumeRuns or expects ErrUnknownSandbox from a run mismatch.
  • Gates on this branch (main c6304c4 plus this commit): golangci-lint 0 issues in all five modules on linux and darwin, asl clean, go test -race ./... green on darwin and in a linux container; Go comment lines +0 -0.

Hot path

None of these functions is on the claim path: they run on a volume change and on the remount after a guest reboot.

Not run on hardware: nothing reachable changes.

m.volumeRuns has one insert and one delete, both by the run's owner, and every
function that takes the run runs inside that owner, so the check could not fire.
A replaced or released record is still refused by heldErrLocked and holdsLocked.
@CMGS
CMGS merged commit f23328d into main Dec 2, 2026
2 checks passed
@CMGS
CMGS deleted the pool/volume-run-check branch December 2, 2026 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant