Rust example ramdisk, writes fail with "Function not implemented"
Closed this issue · 2 comments
apps4uco commented
cargo build --release --example ramdisk
nbdfuse /tmp/ram --command nbdkit -v -s --filter=log .target/release/examples/libramdisk.so logfile=/tmp/log.txt
Mount shows that the partition is rw
/dev/fuse on /tmp/ram type fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
The log shows write=1 so it should be writable.
Reads work fine
dd if=/tmp/ram/nbd of=/dev/null
204800+0 records in
204800+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0,297866 s, 352 MB/s
od /tmp/ram/nbd
0000000 000000 000000 000000 000000 000000 000000 000000 000000
*
620000000
Writes do not work
dd if=/dev/urandom of=/tmp/ram/nbd
dd: failed to open '/tmp/ram/nbd': Function not implemented
I have also tried implementing all the methods on Server in a forked version of ramdisk.
Same issue.
I also forked the ndbkit rustcode and changed unimplemented!() to unimplemented!("name of function") to see if I could get some more details. Nothing changed
(However, I understand that a panic over a ffi boundary is undefined behaviour. )
Any suggestions?
asomers commented
It isn't panicing. Some system call is returning ENOSYS. What environment are you running in? Can you use ktrace, strace, etc to see what's failing?
rwmjones commented
I tried this and it works fine for me:
```
$ nbdfuse /tmp/ram --command nbdkit -v -s ./plugins/rust/target/release/examples/libramdisk.so
...
$ dd if=/dev/urandom of=/tmp/ram/nbd bs=512 count=1
1+0 records in
1+0 records out
512 bytes copied, 0.000274812 s, 1.9 MB/s
$ fusermount3 -u /tmp/ram
```
What version of nbdkit, nbdfuse, etc are you using? On what platform?
Did you try it without the log filter?