Closed PhilLehmann closed 7 years ago
You shoudn't call the MountUtils.unmout()
for WinFsp, but its required by fuse. WinFsp listen Ctrl+C
break event to unmount the path.
Well I just call AbstractFuseFS.umount
as I would on any other OS, which then calls MountUtils.umount
.
That method seems to have code for Linux and macOS, but not Windows.
As WinFsp is handed over to LibraryLoader<LibFuse>
, maybe that can be used to send the CTRL + C to it. Studying the code, I could not find a way... maybe there is a non obvious solution? We should implement this solution within AbstractFuseFS.umount
, so that it behaves the same for all three OS. The mount
command of it does, too.
We might be able to use the windows command taskkill /pid <pid>
to terminate the WinFsp process in question. Would that be feasible?
Unfortunately, taskkill
does not send Ctrl+C
event to console application.
Hi, @philrykoff!
As mentioned before, I don't see any feasible way to implement unmounting for reasons described in https://github.com/billziss-gh/winfsp/issues/47. It might make sense to throw a reasonable exception though instead of calling linux
/macos
tools.
That would be better than the status quo...
This guy managed to send CTRL C from Java, but only via yet another native dependancy (SendMessage.exe) - https://stackoverflow.com/a/10336831/284364
So while that way would offer a solution, it would be a truly ugly one. I'll ask the WinFsp guys about the possibility to add an invokable api.
Under WinFsp-FUSE fuse_exit
is able to cleanly exit and unmount the file system.
For example, here is how I handle FUSE unmount in cgofuse:
https://github.com/billziss-gh/cgofuse/blob/v1.0.3/fuse/host.go#L459-L492
@billziss-gh Thanks for the info! Then it's actually very easy to implement.
Hey, @philrykoff!
I added the fuse_exit
method on master
. Can you check that it solves the problem?
Unmounting works like a charm - thanks so much! 😄
Good work @SerCeMan :)
I published 0.5.1
with the fix included.
Thanks for this great library. I just couldn't believe how quick one could get started! :-)
I am not sure whether this is a usage question or a bug report, so let's go:
When mounting,
AbstractFuseFS
uses the correct path to WinFsp to initialize communication with it:https://github.com/SerCeMan/jnr-fuse/blob/4b97249333ef360335ed7fe2e7cf46a37f34cfcd/src/main/java/ru/serce/jnrfuse/AbstractFuseFS.java#L63
For unmounting, it simply calls
MountUtils
which does not seem to be aware of WinFsp:https://github.com/SerCeMan/jnr-fuse/blob/561d140f9bf6e1ecb66327abaee91d16554af582/src/main/java/ru/serce/jnrfuse/utils/MountUtils.java#L16-L20
So unmounting fails and the device stays forever. Am I doing something wrong or does WinFsp not support unmounting? Thanks!