libguestfs/nbdkit

Rust example ramdisk, writes fail with "Function not implemented"

Closed this issue · 2 comments

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?

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?