You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On a microVM aggregate mount (VirtioFs::new_microvm_aggregate) configured with one or more single-file child shares (MicroVmAggregateChild::new_file), FUSE_GETATTR and FUSE_STATX on the synthetic root (FUSE_ROOT_ID) report nlink = 2 + entries.len(), counting every attached child regardless of whether it exposes a directory or a regular file. Under POSIX stat(2) directory link-count semantics, a directory's st_nlink is 2 plus one per subdirectory (..), whereas regular-file entries do not increment their parent directory's link count. Found by testing.
Meanwhile, plain READDIR in VirtioFs::write_child_entry correctly distinguishes single-file shares (volume.exposed_file().is_some(), emitted as lx::DT_REG) from directory shares (lx::DT_DIR), creating an inconsistency between st_nlink and the directory entries emitted by READDIR / READDIRPLUS.
Consequence
Guest utilities that rely on POSIX directory link-count invariants (such as find, fts, and backup/traversal tools applying the st_nlink - 2 leaf-directory optimization) observe a larger subdirectory count on the mount root than the number of DT_DIR entries actually present when single-file shares are attached.
Reproduction
Construct a microVM aggregate via VirtioFs::new_microvm_aggregate with one directory share (MicroVmAggregateChild::new("work", ...)) and one single-file share (MicroVmAggregateChild::new_file("seed", ...)).
Query Fuse::get_attr(&fs, &request(FUSE_ROOT_ID), 0, 0) and Fuse::get_statx(&fs, &request(FUSE_ROOT_ID), ...).
In VirtioFs::synthetic_root_nlink, count only aggregate entries whose volume exposes a directory (entry.volume.exposed_file().is_none()) before saturatingly adding 2, matching the DT_DIR vs. DT_REG distinction in VirtioFs::write_child_entry.
Activity
tangruize commentedon Nov 15, 2026
Suggested Fix
In
VirtioFs::synthetic_root_nlink, count only aggregate entries whose volume exposes a directory (entry.volume.exposed_file().is_none()) before saturatingly adding2, matching theDT_DIRvs.DT_REGdistinction inVirtioFs::write_child_entry.Patch against OpenVMM
9d64daad3cbe14fb0591081b73c6c9648e18d0fb. Save the contents below asfix.patchand rungit apply fix.patch.fix.patch