-
Notifications
You must be signed in to change notification settings - Fork 855
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
WSL 2's drvfs can't list directories on many third-party filesystems #6063
Comments
This isn't technically the same issue -- but as long as we're collecting changes that should go into
Here's a dump I've created of every possible |
Proposed
|
@reidrankin - Thank you for filing this excellent issue. It does look like there are some deficiencies in our current error mapping, I'll take a look at this. |
Not sure if this is the same problem, but I am experiencing the following similar issue with WSL2 on Windows 10 version 20H2 (OS build 19042.630):
|
This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request. Thank you! |
Environment
Steps to reproduce
Using a development version of Dokan:
Then, on WSL 2:
![wsl](https://user-images.githubusercontent.com/645226/95510735-61701300-0984-11eb-8c2a-3c341569b621.png)
WSL logs:
Expected behavior
ls -al /mnt/x
listsbar.txt
Actual behavior
ls -al /mnt/x
returnsls: reading directory '/mnt/x': Function not implemented
The Actual Problem
Many third-party filesystems (Dokan and StableBit DrivePool, for example) don't work with WSL 2 because they don't return the (technically) correct error code when asked for an unsupported FileInformationClass in
IRP_MN_QUERY_DIRECTORY
requests.Why
WSL2's implementation of
drvfs
connects to a 9P2000.L (Plan 9) file server over a Hyper-V socket. The Plan 9 server code is invp9fs.dll
, and is hosted in adllhost.exe
process which runs with the token of the user that launched the WSL distro. It invokes invokes ZwQueryDirectoryFile, asking for theFileIdExtdDirectoryInformation
information class first. A fallback mechanism exists which will retry the request with increasingly general information classes (namelyFileIdFullDirectoryInformation
,FileIdBothDirectoryInformation
,FileFullDirectoryInformation
, andFileDirectoryInformation
, in that order). However, this fallback only occurs if the request completes with STATUS_SUCCESS and sets the IO_STATUS_BLOCKStatus
parameter toSTATUS_INVALID_INFO_CLASS
,STATUS_INVALID_PARAMETER
, orSTATUS_NOT_SUPPORTED
.As far as standards go, [MS-FSCC] sections 2.4 and 2.5 seem to indicate that
STATUS_INVALID_PARAMETER
is the correct return code for functions which are implemented but which are asked to query or set an unimplemented information class. However, this is quite an esoteric requirement, and many third-party filesystems return other codes; Dokan returnsSTATUS_NOT_IMPLEMENTED
, and DrivePool returnsSTATUS_INTERNAL_ERROR
, but other filesystems may use other values.The Solution
The relevant fallback code in the
LxUtilpDirectoryEnumeratorFillBuffer()
function invp9fs.dll
should be updated to attempt fallback in response to a more general set of error codes; also consider matching against a set of explicitly excluded codes instead of a set of included ones.Third-party filesystem drivers should be updated to return the canonical
STATUS_INVALID_PARAMETER
value in response to requests for unsupported file information classes.The Terrible Example
A quick-n-dirty patch I wrote in Cheat Engine will edit the code in the copy of
vp9fs.dll
loaded by thedllhost.exe
instance serving as the WSL 2 Plan 9 file server so that it also works withSTATUS_NOT_IMPLEMENTED
andSTATUS_INTERNAL_ERROR
. It may be instructive to engineers trying to fix the issue, but no one should actually use this unless you understand A) what it does and B) how little sympathy you'll get if you screw up something trying to hack Windows with what's essentially a game trainer.References
The text was updated successfully, but these errors were encountered: