summary refs log tree commit diff stats
path: root/hw/display/virtio-gpu-pci.c
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2015-09-29 16:54:10 +0100
committerKevin Wolf <kwolf@redhat.com>2015-10-02 13:48:29 +0200
commit73ba05d936e82fe01b2b2cf987bf3aecb4792af5 (patch)
tree8402b957686a90af0310701e08cbc4319da12749 /hw/display/virtio-gpu-pci.c
parent99b7e7756780cec03fe5175db0f53b2fffa9426b (diff)
downloadfocaccia-qemu-73ba05d936e82fe01b2b2cf987bf3aecb4792af5.tar.gz
focaccia-qemu-73ba05d936e82fe01b2b2cf987bf3aecb4792af5.zip
block/raw-posix: Open file descriptor O_RDWR to work around glibc posix_fallocate emulation issue.
  https://bugzilla.redhat.com/show_bug.cgi?id=1265196

The following command fails on an NFS mountpoint:

  $ qemu-img create -f qcow2 -o preallocation=falloc disk.img 262144
  Formatting 'disk.img', fmt=qcow2 size=262144 encryption=off cluster_size=65536 preallocation='falloc' lazy_refcounts=off
  qemu-img: disk.img: Could not preallocate data for the new file: Bad file descriptor

The reason turns out to be because NFS doesn't support the
posix_fallocate call.  glibc emulates it instead.  However glibc's
emulation involves using the pread(2) syscall.  The pread syscall
fails with EBADF if the file descriptor is opened without the read
open-flag (ie. open (..., O_WRONLY)).

I contacted glibc upstream about this, and their response is here:

  https://bugzilla.redhat.com/show_bug.cgi?id=1265196#c9

There are two possible fixes: Use Linux fallocate directly, or (this
fix) work around the problem in qemu by opening the file with O_RDWR
instead of O_WRONLY.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1265196
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/display/virtio-gpu-pci.c')
0 files changed, 0 insertions, 0 deletions