Commit 997dd8df authored by Liu Yuan's avatar Liu Yuan Committed by Stefan Hajnoczi
Browse files

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: default avatarLiu Yuan <namei.unix@gmail.com>
Signed-off-by: default avatarFam Zheng <famz@redhat.com>
Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
parent 533ffb17
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -138,8 +138,10 @@ static void quorum_aio_cancel(BlockDriverAIOCB *blockacb)

    /* cancel all callbacks */
    for (i = 0; i < s->num_children; i++) {
        if (acb->qcrs[i].aiocb) {
            bdrv_aio_cancel(acb->qcrs[i].aiocb);
        }
    }

    g_free(acb->qcrs);
    qemu_aio_release(acb);