Skip to content

Make config updates and other parts safe with concurrency#19

Merged
aljoscha merged 6 commits into
mainfrom
config-lock
Jun 4, 2026
Merged

Make config updates and other parts safe with concurrency#19
aljoscha merged 6 commits into
mainfrom
config-lock

Conversation

@aljoscha

@aljoscha aljoscha commented Jun 4, 2026

Copy link
Copy Markdown
Owner

No description provided.

aljoscha added 6 commits June 4, 2026 10:24
Hold the exclusive flock across the whole read-modify-write so concurrent
processes can't lose each other's updates. Add update/update_with for
read-modify-write, create for write-once, and lock_vm for serializing
whole lifecycle commands on one VM name. write remains a thin internal
shim until all callers migrate.
Add vm::create (write-once, fails if the VM already exists) and vm::update
(delta closure applied under the lock), the metadata-side counterparts to the
StateStore primitives. vm::save stays as a shim until its callers migrate.
Route allocate/allocate_single/release through StateStore::update(_with) so
the find-free-block-and-insert runs under one lock. Closes the
double-allocation race where two concurrent vm creates could claim the same
/30 block.
Add registry::update and migrate pull/build/rename/remove to it so concurrent
image commands can't lose each other's registry entries. Drop
ImageRegistry::save; the rename path's storage work stays outside the lock and
dependent VM records are updated via vm::update.
Migrate every lifecycle command to vm::create / vm::update / store::create /
store::update, take the per-VM operation lock for the whole command (fixing
the create TOCTOU and double-start), download kernels outside the config lock,
and make 'ember init' fail rather than clobber an initialized store. Drop the
now-unused vm::save.
All mutations now go through update/update_with/create, which hold the lock
across the whole transaction. Remove the public write so an unlocked
read-then-write can't reintroduce the lost-update window.
@aljoscha aljoscha merged commit 7ab962b into main Jun 4, 2026
2 checks passed
@aljoscha aljoscha deleted the config-lock branch June 4, 2026 08:30
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