Skip to content

No VM takes an image lease, so Img.delete/1 removes an image a VM is running from #207

Backlog

Description

@markovejnovic

Found by model checking (the Quint specs in #206). A counterexample in the model, each step read in the code at e281a48. Not reproduced on a running system.

  • Where: lib/hyper/node/img.ex:104-130: with_image/3 is the only route to Lease.bump/3 and has no caller (grep -rn with_image lib test finds its definition only). lib/hyper/node/img/mutable.ex:112-134: a boot activates the image and leases nothing. lib/hyper/img.ex:151-173: forget/1 refuses only on an unexpired lease.
  • Effect: Hyper.Img.delete/1 on an image a VM is running from returns :ok where its doc promises {:error, :in_use}. It deletes the images row and unlinks every blob of the chain that no other image shares. On a local filesystem the VM likely keeps running, because its loop device pins the unlinked inode. NFS was not looked at.
  • Latent today: delete/1 has no caller in lib/. test/hyper/img/delete_test.exs:48 gets its :in_use by calling Lease.bump/3 itself.
  • Model: image_store_as_built violates mountedChainsPresent. image_store_leased, where a boot takes the lease, holds. The trace, from spec/ on that branch after npm ci:
    node_modules/.bin/quint run image_store.qnt --main image_store_as_built \
      --invariant mountedChainsPresent --max-samples 100000 --max-steps 40
  • Repro: not written. In the E2E suite, boot a VM from an image and call Hyper.Img.delete/1 on that image.
  • Fix: take the lease before Img.activate/1 and hold it for the VM's lifetime. What the lease still does not cover is in An image lease is not a fence: a lapsed lease lets delete through under a live VM #208.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Fields

    No fields configured for issues without a type.

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions