[PULL 05/51] block/replication.c: Avoid cancelling the job twice

Kevin Wolf posted 51 patches 4 years, 11 months ago
Maintainers: Stefan Weil <sw@weilnetz.de>, Stefan Hajnoczi <stefanha@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Fam Zheng <fam@euphon.net>, John Snow <jsnow@redhat.com>, Wen Congyang <wencongyang2@huawei.com>, "Denis V. Lunev" <den@openvz.org>, Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>, Jeff Cody <codyprime@gmail.com>, Alberto Garcia <berto@igalia.com>, Max Reitz <mreitz@redhat.com>, Ari Sundholm <ari@tuxera.com>, Xie Changlong <xiechanglong.d@gmail.com>
There is a newer version of this series
[PULL 05/51] block/replication.c: Avoid cancelling the job twice
Posted by Kevin Wolf 4 years, 11 months ago
From: Lukas Straub <lukasstraub2@web.de>

If qemu in colo secondary mode is stopped, it crashes because
s->backup_job is canceled twice: First with job_cancel_sync_all()
in qemu_cleanup() and then in replication_stop().

Fix this by assigning NULL to s->backup_job when the job completes
so replication_stop() and replication_do_checkpoint() won't touch
the job.

Signed-off-by: Lukas Straub <lukasstraub2@web.de>
Message-Id: <20200511090801.7ed5d8f3@luklap>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/replication.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/block/replication.c b/block/replication.c
index 971f0fe266..c03980a192 100644
--- a/block/replication.c
+++ b/block/replication.c
@@ -398,6 +398,8 @@ static void backup_job_cleanup(BlockDriverState *bs)
     BDRVReplicationState *s = bs->opaque;
     BlockDriverState *top_bs;
 
+    s->backup_job = NULL;
+
     top_bs = bdrv_lookup_bs(s->top_id, s->top_id, NULL);
     if (!top_bs) {
         return;
-- 
2.25.4