From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58260) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYV3Y-000549-Kx for qemu-devel@nongnu.org; Fri, 21 Jul 2017 06:21:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dYV3X-0006xe-Qw for qemu-devel@nongnu.org; Fri, 21 Jul 2017 06:21:12 -0400 From: Fam Zheng Date: Fri, 21 Jul 2017 18:20:57 +0800 Message-Id: <20170721102059.14663-1-famz@redhat.com> Subject: [Qemu-devel] [PATCH 0/2] block: Do OFD lock check at runtime List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Kevin Wolf , Andrew Baumann , jsnow@redhat.com, Max Reitz , eblake@redhat.com 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). 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 | 72 +++++++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 72 insertions(+), 20 deletions(-) -- 2.13.3