[Qemu-devel] [PATCH for-2.10? v3 0/2] block: Do OFD lock check at runtime

Fam Zheng posted 2 patches 6 years, 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20170811114447.25187-1-famz@redhat.com
Test FreeBSD passed
Test checkpatch passed
Test docker passed
Test s390x passed
block/file-posix.c   | 19 +++++++--------
include/qemu/osdep.h |  1 +
util/osdep.c         | 66 ++++++++++++++++++++++++++++++++++++++++++++--------
3 files changed, 65 insertions(+), 21 deletions(-)
[Qemu-devel] [PATCH for-2.10? v3 0/2] block: Do OFD lock check at runtime
Posted by Fam Zheng 6 years, 8 months ago
v3: Fix mingw build. [patchew]

v2: Probe /dev/null to save LOC. [Eric]
    Mention "new glibc + old kernel" in commit message. [Kevin, Daniel, Eric,
    Christian]

This fixes the image opening failure reported by Andrew Baumann:

> I'm running a recent Linux build of qemu on Windows Subsystem for Linux (WSL)
> which doesn't appear to implement file locking:
>
> $ qemu-system-aarch64 ... -drive file=test.vhdx,if=none,id=hd0 -device virtio-blk-pci,drive=hd0
> qemu-system-aarch64: -drive file=test.vhdx,if=none,id=hd0: Failed to unlock byte 100
> qemu-system-aarch64: -drive file=test.vhdx,if=none,id=hd0: Failed to unlock byte 100
> qemu-system-aarch64: -drive file=test.vhdx,if=none,id=hd0: Failed to lock byte 100

It appears to be that the binary is built for Linux targets, but the WSL
runtime doesn't recognize the ops (-EINVAL).

This is also a practical problem for Linux considering it's possible to run
QEMU which is built against a new glibc on an old kernel that doesn't have OFD
API.

Convert to runtime check to cope with that.

Fam Zheng (2):
  osdep: Add runtime OFD lock detection
  file-posix: Do runtime check for ofd lock API

 block/file-posix.c   | 19 +++++++--------
 include/qemu/osdep.h |  1 +
 util/osdep.c         | 66 ++++++++++++++++++++++++++++++++++++++++++++--------
 3 files changed, 65 insertions(+), 21 deletions(-)

-- 
2.13.4


Re: [Qemu-devel] [PATCH for-2.10? v3 0/2] block: Do OFD lock check at runtime
Posted by Kevin Wolf 6 years, 8 months ago
Am 11.08.2017 um 13:44 hat Fam Zheng geschrieben:
> v3: Fix mingw build. [patchew]
> 
> v2: Probe /dev/null to save LOC. [Eric]
>     Mention "new glibc + old kernel" in commit message. [Kevin, Daniel, Eric,
>     Christian]
> 
> This fixes the image opening failure reported by Andrew Baumann:
> 
> > I'm running a recent Linux build of qemu on Windows Subsystem for Linux (WSL)
> > which doesn't appear to implement file locking:
> >
> > $ qemu-system-aarch64 ... -drive file=test.vhdx,if=none,id=hd0 -device virtio-blk-pci,drive=hd0
> > qemu-system-aarch64: -drive file=test.vhdx,if=none,id=hd0: Failed to unlock byte 100
> > qemu-system-aarch64: -drive file=test.vhdx,if=none,id=hd0: Failed to unlock byte 100
> > qemu-system-aarch64: -drive file=test.vhdx,if=none,id=hd0: Failed to lock byte 100
> 
> It appears to be that the binary is built for Linux targets, but the WSL
> runtime doesn't recognize the ops (-EINVAL).
> 
> This is also a practical problem for Linux considering it's possible to run
> QEMU which is built against a new glibc on an old kernel that doesn't have OFD
> API.
> 
> Convert to runtime check to cope with that.

Thanks, applied to the block branch.

Kevin