diff options
| author | Liu Yuan | 2014-09-11 07:41:21 +0200 |
|---|---|---|
| committer | Stefan Hajnoczi | 2014-09-22 12:39:12 +0200 |
| commit | 997dd8df3e95b2fdbd1f30b3deefaad4e9efd14a (patch) | |
| tree | 1efa7e763cae64478340b9f40ba1b965fd680734 | |
| parent | qed: Drop qed_aiocb_info.cancel (diff) | |
| download | qemu-997dd8df3e95b2fdbd1f30b3deefaad4e9efd14a.tar.gz qemu-997dd8df3e95b2fdbd1f30b3deefaad4e9efd14a.tar.xz qemu-997dd8df3e95b2fdbd1f30b3deefaad4e9efd14a.zip | |
quorum: fix quorum_aio_cancel()
For a fifo read pattern, we only have one running aio (possible other cases that
has less number than num_children in the future), so we need to check if
.acb is NULL against bdrv_aio_cancel() to avoid segfault.
Cc: Eric Blake <eblake@redhat.com>
Cc: Benoit Canet <benoit@irqsave.net>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
| -rw-r--r-- | block/quorum.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/block/quorum.c b/block/quorum.c index 093382e8f5..41c4249547 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -138,7 +138,9 @@ static void quorum_aio_cancel(BlockDriverAIOCB *blockacb) /* cancel all callbacks */ for (i = 0; i < s->num_children; i++) { - bdrv_aio_cancel(acb->qcrs[i].aiocb); + if (acb->qcrs[i].aiocb) { + bdrv_aio_cancel(acb->qcrs[i].aiocb); + } } g_free(acb->qcrs); |
