Skip to content

openvmm: pin new microVM objects that take the last node ID - #2144

Merged
Pedro Henrique Penna (ppenna) merged 2 commits into
devfrom
agents/issue-2135-virtiofs-last-node-id
Nov 25, 2026
Merged

Pedro Henrique Penna (ppenna) merged 2 commits into
devfrom
agents/issue-2135-virtiofs-last-node-id

Conversation

@ppenna

@ppenna Pedro Henrique Penna (ppenna) commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2135

What does this pull request change?

A microVM guest's FUSE_MKDIR, FUSE_MKNOD, FUSE_SYMLINK, or FUSE_CREATE on a read-write virtio-fs share, made when the share's node table had only its last node ID, u64::MAX - 1, left to hand out, made its object on the host and then failed with ENOSPC. The guest saw the request fail while the object stayed on the host without a node, and every retry under another name left another such object. Now the object takes that node ID and the request succeeds; the next request that needs a node fails with ENOSPC before it changes the host, as Nodes, Handles, and Listings already says: the server checks its bounds before it changes the host, and node IDs stop one below their 64-bit maximum. A restore reaches that state, since it accepts any next node ID above the saved ones; live requests would need some 2^64 allocations.

The fix is in OpenVMM, microsoft/openvmm#5281, which this pull request pins:

  • virtiofs: let a new microVM object take the last node ID. InodeReservation::insert (vm/devices/virtio/virtiofs/src/lib.rs), which inserts the node of the object that one of these requests made, with the node ID that the request reserved before it made the object, now checks the insert with a new InodeMap::preflight_microvm_reserved_insert (microvm/limits.rs). It shares the code of preflight_microvm_insert and skips only its check that the table can hand out another node ID; the inode limit, the alias limits, the path checks, and their order are unchanged. One regression test in microvm/fs_tests.rs.

The NVX commits are the gitlink-only pin and the mapping of the commit, position 389, in the OpenVMM roadmap. Start with the OpenVMM diff: git diff --submodule=diff origin/dev...HEAD.

Left out and limitations:

  • The design document needs no change, since it already describes the fixed behavior.
  • The checks that run before a request changes the host, and the inserts without a reservation, such as a FUSE_LOOKUP's, keep the check of the next node ID, so a full table still refuses them first. File handles were not affected: their reserved insert already checked only the handle limit.

Why is this change needed?

A guest whose request fails believes that nothing happened, so the share kept objects that the guest never learned of, one more per retry, and the next save recorded neither them nor the node that the request should have returned.

Root cause: these requests reserve the node ID of their object before they make it, so that a full table refuses them before the host changes, and then insert the object's node with that ID. Position 081 of the microVM chain (dbf0fa400, PR18 of the OpenVMM roadmap) has InodeReservation::insert check that insert with InodeMap::preflight_microvm_insert, which, for a node of its own, also requires that the table can hand out its next node ID. The reservation has already taken that ID, so the check asked about the ID after it. After a reservation of u64::MAX - 1, the table's next node ID is u64::MAX, which HandleMap::can_insert never hands out, so the insert failed although it needed no other ID. Position 083's restore, which accepts any next node ID above the saved ones, makes that state reachable, and position 350 (301937559, #1627), which stopped the tables from handing out u64::MAX, moved the failure from a reservation of u64::MAX to one of u64::MAX - 1.

Alternatives rejected:

  • The issue's patch, which threads a reserved flag through preflight_microvm_insert, is the approach taken, adapted to the current code: the flag reaches only the new-node check, and the pre-host check, preflight_microvm_new_inode, keeps its signature and behavior.
  • Dropping the check from the reserved insert altogether: the inode and alias limits must still hold for it, as the issue asks and as the existing retyped_object_is_refused_at_the_inode_limit checks for a reserved insert at the inode limit.
  • Removing the host object when the insert fails: the failure was spurious, and a rollback cannot undo a FUSE_CREATE that opened and truncated an existing file.
  • Letting the table hand out u64::MAX: it is the synthetic aggregate root's directory handle, and a table that hands it out wraps its next ID to 0, which a restore rejects (openvmm: virtiofs: HandleMap::can_insert hands out u64::MAX, colliding with SYNTHETIC_ROOT_FH #1627).

How was this change validated?

Checks and results. "Before" is OpenVMM 1633b3797, the head of feature/microvm/dev and NVX's pin on dev, with the new test; "after" is the pin, 350018ce4, on Windows 11 Enterprise (local workstation, NTFS) and on a Linux KVM test VM (Azure Linux 3, kernel 6.18, x86_64, tmpfs), where the same patch was applied on 1633b3797.

Check Before After
cargo nextest run --profile agent -p virtiofs -E 'test(a_created_object_takes_the_last_node_id)' (new test), on Windows and Linux fails: FUSE_MKDIR returns ENOSPC instead of node u64::MAX - 1 passes on both
A probe, not committed: each of FUSE_MKDIR, FUSE_MKNOD, FUSE_SYMLINK, and FUSE_CREATE twice, under two names, after a restore whose next node ID is u64::MAX - 1, then a save, on Windows and Linux each request fails with ENOSPC and leaves its object on the host, both times; the save records no new node and the next node ID u64::MAX - 1 the first returns node u64::MAX - 1; the second fails with ENOSPC and leaves nothing on the host; the save records the node and the next node ID u64::MAX
cargo check, cargo clippy --all-targets, and cargo doc --no-deps, each -p virtiofs no warnings on Windows and Linux
cargo nextest run --profile agent -p virtiofs Windows: 241 passed, 3 skipped; Linux: 242 passed, 1 skipped
cargo xtask fmt --fix no changes
cargo test --locked --manifest-path nvx/Cargo.toml --no-default-features --test openvmm_vectors -- --ignored, and the same with --test openvmm_cpu_profiles pass, 4 and 1 tests: the vectors and CPU profiles that nvx copies are unchanged
python scripts/openvmm_pin.py check-branch --topic --target origin/dev, python scripts/openvmm_pin.py check-roadmap --worktree, python scripts/check_markdown_links.py, git diff --check pass; both commits are signed
The roadmap's planned fold of the test into position 350: cargo nextest run --profile agent -p virtiofs at 301937559 with the fix and the test, whose imports are re-expressed there, on Windows the new test fails: FUSE_MKDIR returns ENOSPC 224 passed, 3 skipped
python scripts/local_gates.py --base origin/dev --run --only test-changes markdown-links test-layout openvmm-vectors openvmm-cpu-profiles all pass; no change to existing tests
python scripts/nvx.py check-openvmm-ci --revision 350018ce4335ba60ad722852f4004f90674f69e9 the six required jobs pass, in run 45656335609

Backend, host OS, host type, and guest: no microVM run. A guest reaches the defect only after a restore of a hand-edited saved state, which no scenario makes, and the change leaves every other path as it was, so the unit tests above cover it on Windows and Linux.

Left to CI: the microVM scenarios on KVM, MSHV, and WHP, and the NVX CLI jobs, including the nvx-cli gate's Python tests, which this branch does not change. OpenVMM's CI of the pin, run 45656335609, passed the six jobs that NVX requires on its first attempt.

NVX CI run 45661136291 of the head 8bfe42a45eb passed, its KVM, MSHV, and WHP microVM jobs, its platform jobs, and its NVX CLI jobs on Linux and Windows among them.

Checklist

  • Tests cover the new or fixed behavior, in the layout that
    python3 scripts/check_test_layout.py checks.
  • python3 scripts/check_test_changes.py --base origin/dev lists no change
    to an existing test, or a Changes to existing tests section below
    explains each one.
  • The documentation that the change affects is updated, including
    .github/copilot-instructions.md and the skills when a convention or
    workflow changes.
  • A change to the public API of nvx updates nvx/public-api/ with
    python3 scripts/public_api.py --update.
  • Snapshots, protocols, and on-disk formats stay compatible, or the
    description says how the change versions or migrates them.

Changes to existing tests

None: python scripts/check_test_changes.py --base origin/dev lists no change to an existing test, and the OpenVMM pull request adds one test, and the three imports that it uses, to microvm/fs_tests.rs, and changes no test.

OpenVMM pin

  • OpenVMM pull request: [DO NOT REVIEW] virtiofs: let a new microVM object take the last node ID openvmm#5281, pinned at 350018ce4335ba60ad722852f4004f90674f69e9, one commit on 1633b3797, the head of feature/microvm/dev and NVX's pin on dev.
  • Prerequisites: none. [DO NOT REVIEW] virt_whp: write no internal activity state with the user-mode APIC openvmm#5277, #5278, #5279, and #5280, positions 383-388, have landed on feature/microvm/dev.
  • Equivalence: not applicable; the pinned commit is new. The Linux checks ran the same patch applied on 1633b3797.
  • Roadmap: position 389, 263 commits past the mapped tip, a PR18 fixup: fold it into position 081, whose InodeReservation::insert check it fixes, and its test into position 350, whose node table never hands out u64::MAX. Its changes of lib.rs and limits.rs apply at position 081 as they are, as git merge-tree shows, and at 301937559, position 350, with the fix and the test placed so, the virtiofs tests pass on Windows (224 passed, 3 skipped), and without the fix the test fails. It follows PR18 upstream: upstream main, 8d4e03132, lacks the microVM's limits, and replaying the commit there conflicts.
  • No saved-state, protocol, or ABI format, and no version of any of them, changes; the protocol vectors and CPU profiles that nvx copies are unchanged.
  • Landing order: [DO NOT REVIEW] virtiofs: let a new microVM object take the last node ID openvmm#5281 lands first: the orchestrator fast-forwards feature/microvm/dev exactly to 350018ce4335ba60ad722852f4004f90674f69e9, not with the merge button, which squashes, before this pull request merges. python scripts/openvmm_pin.py land 350018ce4335ba60ad722852f4004f90674f69e9 --remote origin finds that fast-forward.

A microVM's FUSE_MKDIR, FUSE_MKNOD, FUSE_SYMLINK, or FUSE_CREATE that
reserved the last node ID that the node table hands out, u64::MAX - 1,
made its object on the host and then failed with ENOSPC, so the guest
saw the request fail while the object stayed on the host without a
node, and each retry under another name left another such object
(#2135). A restore reaches that state, since it accepts any next node
ID above the saved ones.

Pin microsoft/openvmm 350018ce4335ba60ad722852f4004f90674f69e9, the head
of microsoft/openvmm#5281, one commit on 1633b3797, the head of
feature/microvm/dev, which NVX pins below this commit:

- virtiofs: let a new microVM object take the last node ID. The insert
  of a node with the ID that its request reserved checks the microVM's
  inode and alias limits as before, but no longer requires that the
  table can hand out another node ID after the reserved one. Its test
  fails without the fix, for FUSE_MKDIR, and passes with it, on
  Windows and on Linux, and the virtiofs package's tests pass at the
  pin on both.

No saved-state, protocol, or ABI format, and no version of any of
them, changes. The protocol vectors and CPU profiles that nvx copies
are unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Position 389 remains unassigned rather than included as a PR18 fixup to 081, leaving its adaptations, test placement, and related roadmap updates unresolved.

1 open issue
What changed in this PR

This PR pins an OpenVMM fix for #2135 so microVM virtio-fs creation requests can use the last reserved node ID without failing after creating an object on the host.

Changes:

  • Records OpenVMM revision 350018ce4 at chain position 389.
  • Updates roadmap counts and history, and documents the fix’s dependencies and upstream limitations.
File Description
doc/​openvmm-upstream-roadmap.md Updates the pin metadata and maps the last-node-ID fix into the OpenVMM roadmap.

Review effort: Balanced

Comment thread doc/openvmm-upstream-roadmap.md Resolved
…M roadmap

Map position 389, the commit of microsoft/openvmm#5281, which NVX now
pins at 350018ce4, 263 commits past the mapped tip, on 1633b3797,
position 388, the head of feature/microvm/dev since
microsoft/openvmm#5280 landed positions 386-388:

- 389, virtiofs: let a new microVM object take the last node ID. The
  insert of the node of an object that FUSE_MKDIR, FUSE_MKNOD,
  FUSE_SYMLINK, or FUSE_CREATE makes, with the node ID that the request
  reserved before it made the object, no longer requires that the
  table can hand out another node ID, so that the object takes the
  last node ID, u64::MAX - 1, rather than stay on the host without a
  node after the request fails with ENOSPC (#2135). The inode and
  alias limits still apply to that insert.

Position 389 is a PR18 fixup. It fixes a defect of PR18's position
081, whose InodeReservation::insert check required another free node
ID, which position 083's restore makes reachable and position 350
moved to u64::MAX - 1, and it needs nothing that a later position adds
but, for its test, position 350's table and position 164's helpers.
Fold it into position 081, where its changes of lib.rs and limits.rs
apply as they are, as git merge-tree shows, and its test into position
350, where only the imports conflict: at 301937559, position 350, with
the fix and the test so placed, the virtiofs tests pass on Windows,
and without the fix the test fails. The Scope, the DAG, the fold
sentences, the PR summary, the dependency graph, and the commit
mapping record the fixup. Of positions 372-388, only 385 changes one
of its files, fs_tests.rs. Upstream main, 8d4e03132, lacks the defect,
since it lacks the microVM's limits, and replaying the commit there
conflicts in lib.rs and in the microVM's limits.rs and fs_tests.rs, so
it follows PR18 upstream. The Scope also records that
microsoft/openvmm#5277, microsoft/openvmm#5278, microsoft/openvmm#5279,
and microsoft/openvmm#5280 have landed positions 383-388 on
feature/microvm/dev.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the documentation update recording the OpenVMM fix pin and upstream integration plan.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

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.

virtio-fs microVM: creating an object with the last available node ID leaves an orphan on the host

2 participants