summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/qemu/qemu/0002-file-posix-Do-runtime-check-for-ofd-lock-API.patch
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2017-08-18 18:19:13 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-19 22:15:39 +0100
commit045e3f9283b879f0a09a1512ec509b0c86948b45 (patch)
tree60ea3050908e22a8d7beaca221e3f3be2c4f2d67 /meta/recipes-devtools/qemu/qemu/0002-file-posix-Do-runtime-check-for-ofd-lock-API.patch
parentee195eb03460e9dca41084695d4775ec830cfde7 (diff)
downloadpoky-045e3f9283b879f0a09a1512ec509b0c86948b45.tar.gz
qemu: backport patches to fix boot failure
Backport two patches to fix the following error when booting qemu. Failed to unlock byte 100 (From OE-Core rev: 91eee8b08cd52f49bb1c8f8c680607b3f3a52d24) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/qemu/qemu/0002-file-posix-Do-runtime-check-for-ofd-lock-API.patch')
-rw-r--r--meta/recipes-devtools/qemu/qemu/0002-file-posix-Do-runtime-check-for-ofd-lock-API.patch71
1 files changed, 71 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu/0002-file-posix-Do-runtime-check-for-ofd-lock-API.patch b/meta/recipes-devtools/qemu/qemu/0002-file-posix-Do-runtime-check-for-ofd-lock-API.patch
new file mode 100644
index 0000000000..0dacde46d1
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/0002-file-posix-Do-runtime-check-for-ofd-lock-API.patch
@@ -0,0 +1,71 @@
1From 2b218f5dbcca5fe728b1852d161d7a21fd02b2f5 Mon Sep 17 00:00:00 2001
2From: Fam Zheng <famz@redhat.com>
3Date: Fri, 11 Aug 2017 19:44:47 +0800
4Subject: [PATCH 2/2] file-posix: Do runtime check for ofd lock API
5
6It is reported that on Windows Subsystem for Linux, ofd operations fail
7with -EINVAL. In other words, QEMU binary built with system headers that
8exports F_OFD_SETLK doesn't necessarily run in an environment that
9actually supports it:
10
11$ qemu-system-aarch64 ... -drive file=test.vhdx,if=none,id=hd0 \
12 -device virtio-blk-pci,drive=hd0
13qemu-system-aarch64: -drive file=test.vhdx,if=none,id=hd0: Failed to unlock byte 100
14qemu-system-aarch64: -drive file=test.vhdx,if=none,id=hd0: Failed to unlock byte 100
15qemu-system-aarch64: -drive file=test.vhdx,if=none,id=hd0: Failed to lock byte 100
16
17As a matter of fact this is not WSL specific. It can happen when running
18a QEMU compiled against a newer glibc on an older kernel, such as in
19a containerized environment.
20
21Let's do a runtime check to cope with that.
22
23Reported-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
24Reviewed-by: Eric Blake <eblake@redhat.com>
25Signed-off-by: Fam Zheng <famz@redhat.com>
26Signed-off-by: Kevin Wolf <kwolf@redhat.com>
27
28Upstream-Status: Backport
29Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
30---
31 block/file-posix.c | 19 ++++++++-----------
32 1 file changed, 8 insertions(+), 11 deletions(-)
33
34diff --git a/block/file-posix.c b/block/file-posix.c
35index f4de022ae0..cb3bfce147 100644
36--- a/block/file-posix.c
37+++ b/block/file-posix.c
38@@ -457,22 +457,19 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
39 switch (locking) {
40 case ON_OFF_AUTO_ON:
41 s->use_lock = true;
42-#ifndef F_OFD_SETLK
43- fprintf(stderr,
44- "File lock requested but OFD locking syscall is unavailable, "
45- "falling back to POSIX file locks.\n"
46- "Due to the implementation, locks can be lost unexpectedly.\n");
47-#endif
48+ if (!qemu_has_ofd_lock()) {
49+ fprintf(stderr,
50+ "File lock requested but OFD locking syscall is "
51+ "unavailable, falling back to POSIX file locks.\n"
52+ "Due to the implementation, locks can be lost "
53+ "unexpectedly.\n");
54+ }
55 break;
56 case ON_OFF_AUTO_OFF:
57 s->use_lock = false;
58 break;
59 case ON_OFF_AUTO_AUTO:
60-#ifdef F_OFD_SETLK
61- s->use_lock = true;
62-#else
63- s->use_lock = false;
64-#endif
65+ s->use_lock = qemu_has_ofd_lock();
66 break;
67 default:
68 abort();
69--
702.11.0
71