virtiofs: exit QueryVirtiofsMountSource early if virtiofs disabled#14149
Merged
virtiofs: exit QueryVirtiofsMountSource early if virtiofs disabled#14149
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request fixes an issue where path translation logic would incorrectly query the WSL service for non-drvfs virtiofs shares (e.g., the wslg shared memory mount), causing errors in kernel messages. The fix adds early exit conditions to QueryVirtiofsMountSource and refactors feature flags to be globally accessible without requiring a Config parameter.
Changes:
- Added early exit in
QueryVirtiofsMountSourcewhen virtiofs is disabled or when the tag is not a GUID, preventing unnecessary service queries for non-drvfs virtiofs mounts - Refactored feature flag handling to use a global cache accessible via
UtilGetFeatureFlags()without Config parameter and addedUtilSetFeatureFlags()to update both cache and environment variable - Updated
WSL_USE_VIRTIO_9P()andWSL_USE_VIRTIO_FS()macros and their callers to use the simplified API without Config parameter
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/linux/init/util.h | Updated function signatures - removed Config parameter from UtilGetFeatureFlags() and added new UtilSetFeatureFlags() function |
| src/linux/init/util.cpp | Moved g_CachedFeatureFlags to file scope, refactored feature flag caching to use global state, and implemented UtilSetFeatureFlags() to update both cache and environment variable |
| src/linux/init/drvfs.h | Removed Config parameter from MountPlan9Share() function signature |
| src/linux/init/drvfs.cpp | Added virtiofs-enabled and GUID validation checks in QueryVirtiofsMountSource(), added asserts to MountVirtioFs() and RemountVirtioFs(), removed Config parameter from MountPlan9Share() |
| src/linux/init/config.h | Updated WSL_USE_VIRTIO_9P() and WSL_USE_VIRTIO_FS() macro definitions to call UtilGetFeatureFlags() without Config parameter |
| src/linux/init/config.cpp | Updated callers to use UtilSetFeatureFlags() instead of manually setting environment variable, updated macro calls to parameterless versions, and removed Config parameter from function calls |
34d73d1 to
beef109
Compare
OneBlue
approved these changes
Feb 3, 2026
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.
While experimenting with virtiofs and pmem I noticed that our path translation logic would query the service for the source of the non-drvfs virtiofs shares (for example the wslg shared memory mount in the system distro). This caused an error to be printed in kmesg.
This change ensures that non-drvfs virtiofs shares are skipped by QueryVirtiofsMountSource by only querying the service if virtiofs is enabled, and the tag is a GUID.