virtiofs: add support for mounting directories (not just full volumes)#14073
Merged
Conversation
benhillis
commented
Jan 16, 2026
benhillis
commented
Jan 16, 2026
Contributor
There was a problem hiding this comment.
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 |
OneBlue
reviewed
Jan 22, 2026
8d0830e to
a94e3f5
Compare
OneBlue
reviewed
Jan 27, 2026
OneBlue
reviewed
Jan 27, 2026
OneBlue
approved these changes
Jan 27, 2026
OneBlue
left a comment
Collaborator
There was a problem hiding this comment.
LGTM, one minor comment
ptrivedi
reviewed
Jan 28, 2026
ptrivedi
reviewed
Jan 28, 2026
ptrivedi
reviewed
Jan 28, 2026
| } | ||
| else | ||
| { | ||
| Plan9Source = Source; |
Contributor
There was a problem hiding this comment.
This means Plan9Source has the potential of being null / empty. Could this cause issues with the "path=" option being set up on line 462?
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.
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.