SerCeMan / jnr-fuse

FUSE implementation in Java using Java Native Runtime (JNR)
MIT License
363 stars 86 forks source link

Mounting the file system always blocks #111

Closed melix closed 3 years ago

melix commented 3 years ago

Hi,

I've been playing with this API (version 0.5.5) and something looks broken under my OS. I'm using Linux Mint 20.1, kernel 5.8.0-43-generic.

fusermount -V

fusermount version: 2.9.9

I've basically tried to run the "in memory file system" example. What I see is that when the mount option is set to block, then the mount method will never return. However, the file system is mounted and created, and when in cd from the CLI to the mount point, I can create and read files:

$ touch /tmp/spock_creates_in_memory_F_0_temporaryFolder14156274010971658690/hello.txt
touch: setting times of '/tmp/spock_creates_in_memory_F_0_temporaryFolder14156274010971658690/hello.txt': Function not implemented
$ ls /tmp/spock_creates_in_memory_F_0_temporaryFolder14156274010971658690
hello.txt

If I use the non-blocking version, then mount returns immediately as expected, but ends up with the timeout exception error. Again, I can cd to the mounted directory and create files.

So all in all, it looks like the mount operation succeeded, but for some reason the call to libFuse.fuse_main_real does not return.

SerCeMan commented 3 years ago

Hey, @melix!

fuse_main_real is expected to block and only return when it's unmounted, effectively "spending" the thread, see https://github.com/libfuse/libfuse/blob/77d662459a0fcdf358d515477d33795837e859d5/lib/helper.c#L279-L358

The non-blocking mode of jnr-fuse is a small "convenience" method that performs the same operation on a background thread.

melix commented 3 years ago

mmm, I see. I would suggest to improve the docs a bit, it's a bit confusing :)