Problem with winfsp and shared folder

828 views
Skip to first unread message

Eric Vial

unread,
Jul 7, 2021, 5:29:16 AM7/7/21
to WinFsp
Hi, 

We use winfsp and jnr-fuse on windows for a cloud storage application. Everything works properly in the same computer, files can be accessed from the mount-point. But we're facing a problem when we configure a shared folder within the mount-point. From a linux samba client, it works fine but from windows clients, we have most of the time a "directory name is invalid" error when we try to open a text file. Strangely, the problem never happens with image files. Below the application output with the fuse debug and a failed open. We noticed the value "ShareAccess=7" in the FILE_OPEN output when the open fails and "ShareAccess=3" when the open is successful. Do you have any idea what could cause this issue? Do you know what the ShareAccess value means? 

Thanks

java[TID=5194]: FFFFC108A4617630: >>Create [KT---C] "\hot\test", FILE_OPEN, CreateOptions=1, FileAttributes=10, Security=NULL, AllocationSize=0:0, AccessToken=0000000000001DC8[PID=4], DesiredAccess=a0, GrantedAccess=0, ShareAccess=3 java[TID=5194]: FFFFC108A4617630: <<Create IoStatus=0[1] UserContext=0000000000000000:0000027D72A73A20, GrantedAccess=a0, FileInfo={FileAttributes=10, ReparseTag=0, AllocationSize=0:0, FileSize=0:0, CreationTime=2021-06-21T09:05:53.000Z, LastAccessTime=2021-06-21T09:05:53.000Z, LastWriteTime=2021-06-21T09:05:53.000Z, ChangeTime=2021-06-21T09:05:53.000Z, IndexNumber=0:0} java[TID=5194]: FFFFC108A4615690: >>Create [UT---C] "\hot\test", FILE_OPEN, CreateOptions=100, FileAttributes=0, Security=NULL, AllocationSize=0:0, AccessToken=0000000000001F8C[PID=4], DesiredAccess=100080, GrantedAccess=0, ShareAccess=7 java[TID=5194]: FFFFC108A4615690: <<Create IoStatus=0[1] UserContext=0000000000000000:0000027D72A73810, GrantedAccess=100080, FileInfo={FileAttributes=10, ReparseTag=0, AllocationSize=0:0, FileSize=0:0, CreationTime=2021-06-21T09:05:53.000Z, LastAccessTime=2021-06-21T09:05:53.000Z, LastWriteTime=2021-06-21T09:05:53.000Z, ChangeTime=2021-06-21T09:05:53.000Z, IndexNumber=0:0} java[TID=5194]: FFFFC108A4617630: >>QuerySecurity 0000000000000000:0000027D72A73810 java[TID=5194]: FFFFC108A4617630: <<QuerySecurity IoStatus=0[0] Security="O:WDG:WDD:P(A;;FA;;;WD)(A;;0x1201ef;;;WD)(A;;0x1201ef;;;WD)" java[TID=5194]: FFFFC108A4629A00: >>Close 0000000000000000:0000027D72A73810 java[TID=5194]: FFFFC108A4629A00: <<Close IoStatus=0[0] java[TID=5194]: FFFFC108A5B463D0: >>Create [UT---C] "\hot\test\hello.txt", FILE_OPEN, CreateOptions=200100, FileAttributes=0, Security=NULL, AllocationSize=0:0, AccessToken=0000000000001F64[PID=4], DesiredAccess=80, GrantedAccess=0, ShareAccess=7 java[TID=5194]: FFFFC108A5B463D0: <<Create IoStatus=0[1] UserContext=0000000000000000:0000027D72A738D0, GrantedAccess=80, FileInfo={FileAttributes=0, ReparseTag=0, AllocationSize=0:1000, FileSize=0:24, CreationTime=2021-06-21T09:06:15.000Z, LastAccessTime=2021-06-21T09:06:15.000Z, LastWriteTime=2021-06-21T18:02:16.000Z, ChangeTime=2021-06-21T09:06:15.000Z, IndexNumber=0:0} java[TID=5194]: FFFFC108A5B463D0: >>QuerySecurity 0000000000000000:0000027D72A738D0 java[TID=5194]: FFFFC108A5B463D0: <<QuerySecurity IoStatus=0[0] Security="O:WDG:WDD:P(A;;0x1f01bf;;;WD)(A;;0x1201af;;;WD)(A;;0x1201af;;;WD)" java[TID=5194]: FFFFC108A46330F0: >>Close 0000000000000000:0000027D72A738D0 java[TID=5194]: FFFFC108A46330F0: <<Close IoStatus=0[0] java[TID=5194]: FFFFC108A4620760: >>Create [UT---C] "\hot\test\hello.txt", FILE_OPEN, CreateOptions=140, FileAttributes=0, Security=NULL, AllocationSize=0:0, AccessToken=0000000000001F88[PID=4], DesiredAccess=120089, GrantedAccess=0, ShareAccess=7 java[TID=5194]: FFFFC108A4620760: <<Create IoStatus=0[1] UserContext=0000000000000000:0000027D72A73360, GrantedAccess=120089, FileInfo={FileAttributes=0, ReparseTag=0, AllocationSize=0:1000, FileSize=0:24, CreationTime=2021-06-21T09:06:15.000Z, LastAccessTime=2021-06-21T09:06:15.000Z, LastWriteTime=2021-06-21T18:02:16.000Z, ChangeTime=2021-06-21T09:06:15.000Z, IndexNumber=0:0} java[TID=5194]: FFFFC108A5B463D0: >>QuerySecurity 0000000000000000:0000027D72A73360 java[TID=5194]: FFFFC108A5B463D0: <<QuerySecurity IoStatus=0[0] Security="O:WDG:WDD:P(A;;0x1f01bf;;;WD)(A;;0x1201af;;;WD)(A;;0x1201af;;;WD)" java[TID=5194]: FFFFC10899BFDA70: >>Read 0000000000000000:0000027D72A73360, Address=0000027D7AD70000, Offset=0:0, Length=4096, Key=0 java[TID=5194]: FFFFC10899BFDA70: <<Read IoStatus=0[36]

Bill Zissimopoulos

unread,
Jul 11, 2021, 9:15:12 AM7/11/21
to Eric Vial, WinFsp

Eric, hello. Apologies for the late response as I am currently on vacation.

 

The ShareAccess parameter is basically the same as the dwShareMode of CreateFileW. It specifies how multiple openers of the same file expect to share access to it. This is handled completely by the WinFsp FSD and you do not need to do anything special about it.

 

The "directory name is invalid" error is a very unlikely error to get. Furthermore I do not see the equivalent NTSTATUS code in the log you posted (I expected to see something along the lines of 0xC0000039 - STATUS_OBJECT_PATH_INVALID).

 

So unfortunately I do not have enough information to be of help here.

 

Bill

--
You received this message because you are subscribed to the Google Groups "WinFsp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to winfsp+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/winfsp/830c85a8-f245-4a73-9e40-bc24beb9fe65n%40googlegroups.com.

Eric Vial

unread,
Jul 12, 2021, 5:35:59 AM7/12/21
to WinFsp
Hello Bill, 

Thanks for your reply. 

In order to isolate more easily the problem, I'd like to perform some tests with a shared folder created in the most simple FS relying on WinFsp. I tried memFs but I got "The operation is invalid on a redirected resource" error, it seems that memFs does not support shared folders, does it? Do you know any other libraries I could give it a try with? I found this link http://www.secfs.net/winfsp/doc/Known-File-Systems/, maybe GoldDrive could be a good candidate?

Thanks

Eric

Bill Zissimopoulos

unread,
Jul 12, 2021, 7:14:45 AM7/12/21
to Eric Vial, WinFsp

Eric:

 

Memfs (the one that ships with WinFsp) supports exporting the file system as a shared drive. This is a scenario that is regularly tested as well (via winfsp-tests).

 

Can you please let me know how exactly you are creating the share?

Eric Vial

unread,
Jul 12, 2021, 10:50:36 AM7/12/21
to WinFsp
Bill,

I just mapped the drive " \\memfs64\share" into Z: then I created a folder "Z:\TestShare" and finally I tried to share this folder though the following command in Powershell:

net share TestShare=Z:\TestShare /GRANT:Everyone,FULL
The operation is invalid on a redirected resource.

That's why I thought memFS wasn't supporting shared folder configuration. What did I do wrong?

Thanks

Eric

Bill Zissimopoulos

unread,
Jul 13, 2021, 7:14:56 PM7/13/21
to Eric Vial, WinFsp
I suspect that the problem is that you are creating a local drive (I.e. local to the user account) and not a global drive (I.e. visible to all accounts). Sharing drives works only with global drives I believe.

To create a global drive either create the file system from the SYSTEM account or create the drive using the Mount Manager syntax \\.\X: (requires admin privileges).

Bill

On Jul 12, 2021, at 5:50 PM, Eric Vial <evi...@gmail.com> wrote:

Bill,

Eric Vial

unread,
Jul 14, 2021, 1:24:42 PM7/14/21
to WinFsp
Hello Bill,

Thanks for your quick response, especially if you're still on vacation :)

I ran the command "memfs-x64 -m *" from the SYSTEM account and now the shared folder configuration works properly. With the initial command "memfs-x64 -u \memfs64\share2 -m *", I still have the message: "The operation is invalid on a redirected resource." when sharing a folder (even with the SYSTEM account). Just for my undestanding, do you know why it works without the "-u /Server/Share" argument?

Thanks again

Eric

Bill Zissimopoulos

unread,
Jul 14, 2021, 3:34:11 PM7/14/21
to Eric Vial, WinFsp

Just for my undestanding, do you know why it works without the "-u /Server/Share" argument?

 

Yes.

 

When using the -u \Server\Share argument you are actually creating a "network" file system. A "network" file system is simply a file system whose files can be addressed using a UNC prefix (i.e. \\Server\Share\Path\To\File). A "network" file system cannot be shared, because it is a part of the mechanism that Windows uses to implement the sharing functionality.

 

Without the -u \Server\Share argument you are creating a "disk" or "local" file system (there is no real disk in WinFsp of course). A "local" file system can be exported as a network share.

Reply all
Reply to author
Forward
0 new messages