forked from oxidecomputer/omicron
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only remove counters if instance state is current
Add a clause to the provisioning counter deletion query that checks (atomically via sub-selection) that the instance of interest has not advanced past a particular state generation number. This prevents a TOCTTOU bug that can cause a record to be deleted when an instance is running: - Sled agent tries to send an update stopping an instance; this gets stuck and the attempt times out - Sled agent tries again and the attempt succeeds; this deletes the provisioning counters and allows the instance to start somewhere else - The instance indeed starts somewhere else, taking new charges - The original attempt finally makes progress again and proceeds to delete the newly-allocated charges Also fix an ordering bug in the start saga: provisioning counters should only be charged after the saga has passed through the "only one start attempt at a time" interlock. While the old ordering didn't allow counters to be leaked (parallel start sagas that lose the race to set the instance's Propolis ID will unwind, which would have released the counters), this did allow multiple parallel start sagas to take multiple charges for the same instance.
- Loading branch information
Showing
5 changed files
with
115 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters