[libvirt] [PATCH 2/3] fdstream: introduce virFDStreamOpenBlockDevice

Roman Bogorodskiy bogorodskiy at gmail.com
Fri Aug 15 09:50:37 UTC 2014


  Daniel P. Berrange wrote:

> On Fri, Aug 15, 2014 at 12:55:58PM +0400, Roman Bogorodskiy wrote:
> >   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.
> 
> Ah ok, so can you update the commit message to explicitly mention
> that ZFS character devices are unusual in not supporting O_NOBLOBKJ

I did some more checks and it looks like O_NONBLOCK is not supported not
only on ZFS volumes, but on other disk drivers as well; I got the same
result for SATA and memory disks.

I'll update a commit message to say something like this:

> On FreeBSD, it doesn't work as expected because disks are exposed as
> character devices and do not support O_NONBLOCK.

I'll wait for other comments to avoid resending the series just because
of a commit message change.

Roman Bogorodskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140815/610aba56/attachment-0001.sig>


More information about the libvir-list mailing list