Skip to content

virtiofs: exit QueryVirtiofsMountSource early if virtiofs disabled#14149

Merged
benhillis merged 1 commit intomasterfrom
user/benhill/virtiofs_config_options
Feb 4, 2026
Merged

virtiofs: exit QueryVirtiofsMountSource early if virtiofs disabled#14149
benhillis merged 1 commit intomasterfrom
user/benhill/virtiofs_config_options

Conversation

@benhillis
Copy link
Member

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.

Copy link
Contributor

Copilot AI left a 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 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 QueryVirtiofsMountSource when 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 added UtilSetFeatureFlags() to update both cache and environment variable
  • Updated WSL_USE_VIRTIO_9P() and WSL_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

@benhillis benhillis force-pushed the user/benhill/virtiofs_config_options branch from 34d73d1 to beef109 Compare February 3, 2026 05:06
@benhillis benhillis merged commit 8ae97be into master Feb 4, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants