-
Notifications
You must be signed in to change notification settings - Fork 1.6k
virtiofs: add support for mounting directories (not just full volumes) #14073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
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 |
8d0830e to
a94e3f5
Compare
There was a problem hiding this comment.
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.
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.