Daniel P. Berrange wrote:
On Fri, Aug 15, 2014 at 12:44:21PM +0400, Roman Bogorodskiy wrote:
> virStorageBackendVolDownloadLocal and virStorageBackendVolUploadLocal
> use virFDStreamOpenFile function to work with the volume fd.
>
> virFDStreamOpenFile calls virFDStreamOpenFileInternal that implements
> handling of the non-blocking I/O. If a file is not a character device and
> not a fifo, it uses libvirt_iohelper.
>
> On FreeBSD, it doesn't work as expected because disks are exposed as
> character devices.
Why does that cause a problem ? The reason we use iohelper is because
POSIX does not have O_NONBLOCK work on plain files, so we need to use
the iohelper so that we have a pipe we can set O_NONBLOCK on. If FreeBSD
disks are character devices though, O_NONBLOCK should work fine on them
avoiding the need for iohelper.
O_NONBLOCK doesn't work for some reason, at least on ZFS volumes:
fcntl() fails with:
fcntl: Inappropriate ioctl for device
I have asked a question on an appropriate mailing list:
https://lists.freebsd.org/pipermail/freebsd-fs/2014-August/019923.html
I've also included a test program I use to reproduce that there.
Roman Bogorodskiy