Repository navigation
openvmm: pin FSYNCDIR on an aggregate's synthetic root - #1959
Merged
Pedro Henrique Penna (ppenna) merged 3 commits intoNov 22, 2026
Merged
Pedro Henrique Penna (ppenna) merged 3 commits into
Pedro Henrique Penna (ppenna) merged 3 commits into
Conversation
OpenVMM's virtio-fs server failed FUSE_FSYNCDIR through the handle of an aggregate's synthetic root with EBADF (#1624), so fsync and fdatasync of a descriptor of the root, as `sync DIR` calls, failed in the guest with "Bad file descriptor", which POSIX reserves for a descriptor that is not open. In a microVM whose aggregate is mounted at /run/nvx/shares, `sync /run/nvx/shares` and `sync -d /run/nvx/shares` both failed so. Pin microsoft/openvmm 21b1a55d01bcd7bd916e1cc92c05c70c7d5c80e1, one commit on 655bc319d, the head of microsoft/openvmm#5221: - virtiofs: accept FSYNCDIR through the synthetic root's handle. VirtioFs::fsync_dir succeeds for the root's handle with the root's node, as release_dir does, since the root keeps its entries only in memory and has nothing to write back; every other handle and node reaches get_file as before. Its test fails without the change on Windows and on Linux (nvx-kvm-test). No saved state, protocol, ABI, or 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>
A guest's fsync or fdatasync of a descriptor of an aggregate's synthetic root, which reaches OpenVMM as FUSE_FSYNCDIR through the root's handle, now succeeds without flushing anything, since the root has no host object, where it failed with EBADF (#1624). Say so in 3.6.3, next to the acknowledgment of a guest syncfs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Map position 356, the commit of microsoft/openvmm#5222, which NVX now pins at 21b1a55d0, 230 commits past the mapped tip: - 356, virtiofs: accept FSYNCDIR through the synthetic root's handle. VirtioFs::fsync_dir succeeds for the handle that FUSE_OPENDIR returns for an aggregate's synthetic root, with the root's node, as release_dir does, rather than look that sentinel up in the handle map and fail with EBADF, so fsync and fdatasync of a descriptor of the root succeed in the guest. Position 356 is not yet assigned to a PR. It fixes upstream's fsync_dir, which microsoft/openvmm#3821 adds and which no chain commit changes but position 346, which passes it the request's node, and it changes nothing that a mapped PR adds. Upstream main, bf353460f, has the defect, and replaying the commit there conflicts in lib.rs, next to position 346's node, and in aggregate_tests.rs, among position 350's imports. The same change made on upstream's code applies there without conflicts, and virtiofs type-checks there with its tests, which pass, so it can go upstream on its own in that form. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
5 tasks done
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the OpenVMM pin and synthetic-root sync documentation updates.
No open issues 🎉
What changed in this PR
This PR pins the OpenVMM fix for #1624 so guest fsync() and fdatasync() calls on an aggregate share’s synthetic root succeed instead of returning EBADF.
Changes:
- Documents that syncing the synthetic root succeeds without flushing the host.
- Updates the OpenVMM roadmap to revision
21b1a55d0, position 356, with the fix’s scope and upstream applicability.
| File | Description |
|---|---|
doc/openvmm-upstream-roadmap.md |
Records the new pin, chain position, and upstream mapping. |
doc/design/3.6-host-filesystem.md |
Clarifies sync behavior for an aggregate’s synthetic root. |
Review effort: Balanced
Pedro Henrique Penna (ppenna)
deleted the
agents/issue-1624-synthetic-root-fsyncdir
branch
November 22, 2026 12:10
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1624
What does this pull request change?
It pins microsoft/openvmm#5222 (
21b1a55d0), whose one commit,virtiofs: accept FSYNCDIR through the synthetic root's handle, makesfsync()andfdatasync()of a descriptor of an aggregate's synthetic root succeed in the guest, where they failed withEBADF. OpenVMM's virtio-fs server now answersFUSE_FSYNCDIRthrough the root's handle, with the root's node, with success, as it answersFUSE_RELEASEDIR, since the root keeps its entries only in memory and has nothing to write back. Every other handle and node reachesget_fileas before, with the node check of #1599.The pull request has three commits:
openvmm: pin FSYNCDIR on an aggregate's synthetic root, which changes only the gitlink;doc: say that syncing an aggregate's root succeeds, one clause in 3.6.3 Request Path;doc: map FSYNCDIR on an aggregate's root in the OpenVMM roadmap, which maps the commit as position 356.Start with
VirtioFs::fsync_dirinopenvmm/vm/devices/virtio/virtiofs/src/lib.rsand its regression test,synthetic_root_handle_accepts_fsyncdirinopenvmm/vm/devices/virtio/virtiofs/src/aggregate_tests.rs.Left out:
FUSE_FSYNCthrough the root's handle, which a Linux guest sends only for files, still fails withEBADF, and the handle map'su64::MAXandSYNTHETIC_ROOT_FH(#1627) are handled separately.Why is this change needed?
A guest that syncs the root of an aggregate share, the mount that holds every
--mountof a microVM, assync /run/nvx/sharesorsync -d /run/nvx/sharesdoes, gotBad file descriptor, an error that POSIX reserves for a descriptor that is not open, although it held a valid descriptor of the directory. The Linux FUSE client sendsfsyncandfdatasyncof a directory asFUSE_FSYNCDIR, with the directory's node and the handle thatFUSE_OPENDIRreturned.FUSE_OPENDIRof the synthetic root returns the sentinelSYNTHETIC_ROOT_FH, which names no open file;READDIR,READDIRPLUS,RELEASEDIR, andGETATTRandSTATXthrough a handle recognize it with the root's node, butVirtioFs::fsync_dirlooked it up in the handle map, found nothing, and failed withEBADF. The defect came with upstream's aggregate support,a5f055dd7(microsoft/openvmm#3821), which added the sentinel and the handlers that recognize it, and upstream main still has it.Rejected alternatives:
ENOSYSwould make the Linux client setno_fsyncdirfor the whole mount, so it would stop sendingFSYNCDIRfor the children's real directories too, which have something to write back.EBADF, as they do for the other directory requests.VirtioFs::new_aggregate, which upstream has too, rather than a new integration-test file; the test sends well-formedFUSE_OPENDIR,FUSE_LOOKUP, andFUSE_FSYNCDIRrequests, and also checks that the root's handle with a child's node, and another handle with the root's node, still fail withEBADF.How was this change validated?
Checks and results:
cargo nextest run --profile agent -p virtiofs -E 'test(synthetic_root_handle_accepts_fsyncdir)'inopenvmm/, withlib.rsof the pin's parent655bc319d(fix reverted)flags 0x0,left: Err(Error(EBADF (9))),right: Ok(())cargo nextest run --profile agent -p virtiofsat21b1a55d0cargo check,cargo clippy --all-targets,cargo doc --no-depsforvirtiofsat21b1a55d0, Windows and LinuxLNK4199linker message that every linked artifact gets on the Windows machinecargo xtask fmt --fixinopenvmm/bf353460f:cargo check -p virtiofs --all-targetsandcargo nextest run --profile agent -p virtiofs, Windowspython scripts\openvmm_pin.py source 21b1a55d01bcd7bd916e1cc92c05c70c7d5c80e1 --pr 5222cargo test --locked --manifest-path nvx/Cargo.toml --no-default-features --test openvmm_vectors -- --ignoredand--test openvmm_cpu_profilesnvxcopies are unchangedpython scripts\openvmm_pin.py check-branch --topic --target origin/agents/issue-1606-setgroups-restorepython scripts\openvmm_pin.py check-roadmap --worktreepython scripts\check_markdown_links.py,git diff --check,python scripts\nvx.py verifypython scripts\check_test_changes.py --base origin/agents/issue-1606-setgroups-restorepython scripts\local_gates.py --base origin/agents/issue-1606-setgroups-restore --run --keep-going --only test-changes markdown-links test-layout openvmm-vectors openvmm-cpu-profiles nvx-clinvx-cliran 2,314 unit tests (89 skipped) and 84 adversarial tests (11 skipped)python scripts\nvx.py check-openvmm-ci --revision 21b1a55d01bcd7bd916e1cc92c05c70c7d5c80e1sync /run/nvx/sharesandsync -d /run/nvx/shareswith the aggregate of thefilesystem-sharesscenario, with the OpenVMM of releasev0.1.0-dev.3e98eff40820(b51f9156c)sync: /run/nvx/shares: Bad file descriptorpython3 scripts/nvx.py build-openvmm --backend kvm(provenance21b1a55d0, clean)python3 scripts/nvx.py test-microvm --backend kvm --scenario filesystem-shares --scenario platform-aggregate-export --scenario platform-filesystem --scenario filesystem-snapshotat this pull request's head465d0225d, with that OpenVMM and the guest artifacts ofv0.1.0-dev.3e98eff40820Backend, host OS, host type, and guest: the unit tests ran on Windows 11 (local machine) and on Azure Linux 3.0 (
nvx-kvm-test, virtual machine); the guest checks and the microVM scenarios ran on KVM on Azure Linux 3.0 (nvx-kvm-test, virtual machine) with the Alpine guest, whose guest and kernel inputs are unchanged sincev0.1.0-dev.3e98eff40820, the release that installed them.Left to CI: the MSHV and WHP microVM suites, the rest of the KVM suite, the platform and performance jobs, and
openvmm-ci, which checks OpenVMM's CI of the pinned revision. CI run 44997832368 at this head465d0225dpassed every job that it ran, among them every microVM suite on KVM, MSHV, and WHP, the platform and package jobs, the performance regression gate, andOpenVMM CI of the pinned revision. OpenVMM's CI of the pin also failedrun vmm-tests [x64-windows-amd-snp], which NVX does not require, andrun vmm-tests [x64-windows-intel-tdx], which NVX does not require either, in four TDX hardware-seal TPM tests and a Windows kdnet test, none of which uses virtio-fs, as on microsoft/openvmm#5220.Checklist
python3 scripts/check_test_layout.pychecks.python3 scripts/check_test_changes.py --base origin/devlists no changeto an existing test, or a Changes to existing tests section below
explains each one.
.github/copilot-instructions.mdand the skills when a convention orworkflow changes.
nvxupdatesnvx-rs/public-api/withpython3 scripts/public_api.py --update.description says how the change versions or migrates them.
No version was created or bumped: no ABI, machine-contract, time-ABI, snapshot, manifest, saved-state, protocol, magic, or schema version changes, in NVX or in OpenVMM. The public API of
nvxdoes not change.OpenVMM pin
copilot/nvx-issue-1624-synthetic-root-fsyncdir, Ready, titled[DO NOT REVIEW].21b1a55d01bcd7bd916e1cc92c05c70c7d5c80e1, the pull request's head, signed.agents/issue-1606-setgroups-restore(openvmm: pin the refusal of groups that caller ownership cannot restore #1958, openvmm: lxutil: with_fs_identity cannot safely restore unmapped supplementary groups when setgroups is permitted in a user namespace #1606's layer,213689710), and [DO NOT REVIEW] virtiofs: accept FSYNCDIR through the synthetic root's handle openvmm#5222 on [DO NOT REVIEW] lxutil: fail closed before dropping groups it cannot restore openvmm#5221 (copilot/nvx-issue-1606-setgroups-restore,655bc319d); only the top OpenVMM commit and the three NVX commits above belong to this pull request.feature/microvm/devto21b1a55d01bcd7bd916e1cc92c05c70c7d5c80e1(OpenVMM's merge button squashes and would leave the pin off the branch), then the NVX pull requests below this one, through openvmm: pin the refusal of groups that caller ownership cannot restore #1958, then this pull request.