]>
Commit | Line | Data |
---|---|---|
f1911ca5 DM |
1 | aio_poll() must return true if any work is still pending, even if it didn't make progress, so that qemu_aio_wait() doesn't return too early. |
2 | The possibility of returning early occasionally lead to a failed assertion in bdrv_drain_all(), when some in-flight request was missed and the function didn't really drain all requests. | |
3 | ||
4 | In order to make that change, the return value as specified in the function comment must change for blocking = false; fortunately, the return value of blocking = false callers is only used in test cases, so this change shouldn't cause any trouble. | |
5 | ||
6 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | |
7 | --- | |
8 | aio-posix.c | 3 ++- | |
9 | include/block/aio.h | 6 ++---- | |
10 | tests/test-aio.c | 4 ++-- | |
11 | 3 files changed, 6 insertions(+), 7 deletions(-) | |
12 | ||
13 | Index: new/aio-posix.c | |
14 | =================================================================== | |
15 | --- new.orig/aio-posix.c 2013-01-22 07:10:17.000000000 +0100 | |
16 | +++ new/aio-posix.c 2013-01-22 07:10:43.000000000 +0100 | |
17 | @@ -264,5 +264,6 @@ | |
18 | } | |
19 | } | |
20 | ||
21 | - return progress; | |
22 | + assert(progress || busy); | |
23 | + return true; | |
24 | } | |
25 | Index: new/qemu-aio.h | |
26 | =================================================================== | |
27 | --- new.orig/qemu-aio.h 2013-01-22 07:10:17.000000000 +0100 | |
28 | +++ new/qemu-aio.h 2013-01-22 07:10:43.000000000 +0100 | |
29 | @@ -177,16 +177,14 @@ | |
30 | * aio as a result of executing I/O completion or bh callbacks. | |
31 | * | |
32 | * If there is no pending AIO operation or completion (bottom half), | |
33 | - * return false. If there are pending bottom halves, return true. | |
34 | + * return false. If there are pending AIO operations of bottom halves, | |
35 | + * return true. | |
36 | * | |
37 | * If there are no pending bottom halves, but there are pending AIO | |
38 | * operations, it may not be possible to make any progress without | |
39 | * blocking. If @blocking is true, this function will wait until one | |
40 | * or more AIO events have completed, to ensure something has moved | |
41 | * before returning. | |
42 | - * | |
43 | - * If @blocking is false, this function will also return false if the | |
44 | - * function cannot make any progress without blocking. | |
45 | */ | |
46 | bool aio_poll(AioContext *ctx, bool blocking); | |
47 | ||
48 | Index: new/tests/test-aio.c | |
49 | =================================================================== | |
50 | --- new.orig/tests/test-aio.c 2013-01-22 07:10:17.000000000 +0100 | |
51 | +++ new/tests/test-aio.c 2013-01-22 07:10:43.000000000 +0100 | |
52 | @@ -315,13 +315,13 @@ | |
53 | event_notifier_set(&data.e); | |
54 | g_assert(aio_poll(ctx, false)); | |
55 | g_assert_cmpint(data.n, ==, 1); | |
56 | - g_assert(!aio_poll(ctx, false)); | |
57 | + g_assert(aio_poll(ctx, false)); | |
58 | g_assert_cmpint(data.n, ==, 1); | |
59 | ||
60 | event_notifier_set(&data.e); | |
61 | g_assert(aio_poll(ctx, false)); | |
62 | g_assert_cmpint(data.n, ==, 2); | |
63 | - g_assert(!aio_poll(ctx, false)); | |
64 | + g_assert(aio_poll(ctx, false)); | |
65 | g_assert_cmpint(data.n, ==, 2); | |
66 | ||
67 | event_notifier_set(&dummy.e); |