diff options
author | Chen Qi <Qi.Chen@windriver.com> | 2017-08-18 18:19:13 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-08-19 22:15:39 +0100 |
commit | 045e3f9283b879f0a09a1512ec509b0c86948b45 (patch) | |
tree | 60ea3050908e22a8d7beaca221e3f3be2c4f2d67 /meta/recipes-devtools/qemu/qemu/0002-file-posix-Do-runtime-check-for-ofd-lock-API.patch | |
parent | ee195eb03460e9dca41084695d4775ec830cfde7 (diff) | |
download | poky-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.patch | 71 |
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 @@ | |||
1 | From 2b218f5dbcca5fe728b1852d161d7a21fd02b2f5 Mon Sep 17 00:00:00 2001 | ||
2 | From: Fam Zheng <famz@redhat.com> | ||
3 | Date: Fri, 11 Aug 2017 19:44:47 +0800 | ||
4 | Subject: [PATCH 2/2] file-posix: Do runtime check for ofd lock API | ||
5 | |||
6 | It is reported that on Windows Subsystem for Linux, ofd operations fail | ||
7 | with -EINVAL. In other words, QEMU binary built with system headers that | ||
8 | exports F_OFD_SETLK doesn't necessarily run in an environment that | ||
9 | actually supports it: | ||
10 | |||
11 | $ qemu-system-aarch64 ... -drive file=test.vhdx,if=none,id=hd0 \ | ||
12 | -device virtio-blk-pci,drive=hd0 | ||
13 | qemu-system-aarch64: -drive file=test.vhdx,if=none,id=hd0: Failed to unlock byte 100 | ||
14 | qemu-system-aarch64: -drive file=test.vhdx,if=none,id=hd0: Failed to unlock byte 100 | ||
15 | qemu-system-aarch64: -drive file=test.vhdx,if=none,id=hd0: Failed to lock byte 100 | ||
16 | |||
17 | As a matter of fact this is not WSL specific. It can happen when running | ||
18 | a QEMU compiled against a newer glibc on an older kernel, such as in | ||
19 | a containerized environment. | ||
20 | |||
21 | Let's do a runtime check to cope with that. | ||
22 | |||
23 | Reported-by: Andrew Baumann <Andrew.Baumann@microsoft.com> | ||
24 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
25 | Signed-off-by: Fam Zheng <famz@redhat.com> | ||
26 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
27 | |||
28 | Upstream-Status: Backport | ||
29 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
30 | --- | ||
31 | block/file-posix.c | 19 ++++++++----------- | ||
32 | 1 file changed, 8 insertions(+), 11 deletions(-) | ||
33 | |||
34 | diff --git a/block/file-posix.c b/block/file-posix.c | ||
35 | index 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 | -- | ||
70 | 2.11.0 | ||
71 | |||