Skip to content

virtiofs: add support for mounting directories (not just full volumes)#14073

Merged
benhillis merged 3 commits into
masterfrom
user/benhill/virtiofs_mount_directories
Jan 29, 2026
Merged

virtiofs: add support for mounting directories (not just full volumes)#14073
benhillis merged 3 commits into
masterfrom
user/benhill/virtiofs_mount_directories

Conversation

@benhillis

@benhillis benhillis commented Jan 16, 2026

Copy link
Copy Markdown
Member

The primary behavior change introduced by this PR is that virtiofs can now mount sub-directories instead of just the entire path. This is achieved by using a GUID tag for the vitiofs share and introducing a query method to ask the wsl service for the source of a virtiofs share, instead of relying on parsing the /proc/pid/mountinfo file.

Comment thread src/windows/service/exe/WslCoreVm.cpp Outdated
Comment thread test/windows/UnitTests.cpp

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.

Pull request overview

This PR enables virtiofs to mount subdirectories instead of being limited to full drive volumes. The implementation includes adding the canonicalized path to virtiofs tag names and introducing a fallback mechanism to use Plan9 if virtiofs share creation fails.

Changes:

  • Removed the drive-root restriction for virtiofs mounts, allowing arbitrary directories to be mounted
  • Updated virtiofs tag generation to include the full canonicalized path instead of just the drive letter
  • Added automatic fallback from virtiofs to Plan9 when share creation fails
  • Refactored mount logic by extracting common Plan9 mounting code into a separate function

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/windows/service/exe/WslCoreVm.cpp Updated virtiofs tag generation to include full canonicalized paths; removed drive-root validation
src/shared/inc/stringshared.h Removed IsDriveRoot utility function (no longer needed)
src/linux/init/util.cpp Updated virtiofs source parsing to extract full paths from tags instead of just drive letters
src/linux/init/drvfs.h Renamed MountPlan9Filesystem to MountPlan9Share; added new MountPlan9 wrapper function
src/linux/init/drvfs.cpp Refactored mount logic to try virtiofs first with Plan9 fallback; extracted common Plan9 logic
src/linux/init/config.cpp Updated function calls to use renamed MountPlan9Share; adjusted mount source filtering
test/windows/UnitTests.cpp Removed WslPath test from general unit tests
test/windows/DrvFsTests.cpp Added WslPath test to DrvFs test suite; removed virtiofs skip conditions
test/windows/Common.cpp Refactored string concatenation to use std::format
test/linux/unit_tests/lxtmount.c Added wildcard pattern matching for mount options validation
test/linux/unit_tests/lxtfs.c Updated test expectations to use wildcards for rfd/wfd values
Comment thread src/linux/init/drvfs.cpp Outdated
Comment thread src/windows/service/exe/WslCoreVm.cpp Outdated
Comment thread src/linux/init/util.cpp Outdated
Comment thread src/linux/init/drvfs.cpp Outdated
Comment thread src/linux/init/drvfs.cpp
@benhillis benhillis force-pushed the user/benhill/virtiofs_mount_directories branch from 8d0830e to a94e3f5 Compare January 23, 2026 17:47
@benhillis benhillis requested a review from Copilot January 23, 2026 17:48

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.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Comment thread src/windows/service/exe/WslCoreVm.cpp Outdated
Comment thread src/windows/service/exe/WslCoreVm.cpp
Comment thread test/linux/unit_tests/lxtfs.c

@OneBlue OneBlue left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, one minor comment

Comment thread src/linux/init/drvfs.cpp
Comment thread src/linux/init/drvfs.cpp
Comment thread src/linux/init/drvfs.cpp
}
else
{
Plan9Source = Source;

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.

This means Plan9Source has the potential of being null / empty. Could this cause issues with the "path=" option being set up on line 462?

@benhillis benhillis merged commit 4096e6d into master Jan 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants