Description
Current behavior 😯
When using gix in a virtualised environment, on a virtiofs filesystem backed by ZFS on the host, with cache disabled (--cache=never, which matters as otherwise the situation is not reproducible), it becomes impossible to run "gix clone", whereas "git clone" works fine. The (likely) reason is the use of MAP_SHARED in an mmap system call, which is a MAP_PRIVATE in the corresponding system call for git. MAP_SHARED requires more stringent coherency requirement, which, coupled with --cache=never for virtiofs, makes the "gix clone" command fail with a "No such device" OS level error in the guest OS. Details of the strace analysis may be found here:
Expected behavior 🤔
"gix clone" should work. The current implementation deviates from that of "git" in its use of MAP_SHARED instead of MAP_PRIVATE. On the other hand, MAP_SHARED seems to be prefered in the rust world as MAP_PRIVATE has some ugly corner cases with "unspecified behaviour".
Either gix want to be a bug-for-bug replacement for git, in case use of MAP_PRIVATE is meaningful, and would make it work in a virtualised setting.
Either gix want to stick with a safe rust focused ideology, in which case MAP_PRIVATE is to be frowned upon, but that would kick the can down the road to the question of memory mapping of files in QEMU/VirtioFS, and involves likely uncanny DAX window behaviour, that seems not to be evenly supported by virtualisation frameworks.
This is, in the end, the choice of the author of gix.
Git behavior
It works.
I personally, would like to know what line of code in the gix source code makes the call to a MAP_SHARED mmap. As that would allow to debug the situation more closely w/r to virtualisation and virtiofs (which is my real concern).
Steps to reproduce 🕹
- Set up an incus/lxd virtual machine (not container) running Ubuntu Mantic, with the latest (daily zabbly build of today, which uses the --cache=never option when calling virtiofsd) incus from zabbly.
- Mount a ZFS filesystem on the host
- Export the ZFS filesystem into the guest via "incus device add" commands. (Uses virtiofs v1.10.1 under the hood)
- In the guest, gix clone a git repository.
- Observe the "No such device" os error 19 pop up.