mirror of
https://github.com/qemu/qemu.git
synced 2025-01-19 20:13:27 +08:00
replication: interrupt failover if the main device is closed
Without this change, there is a race condition in tests/test-replication. Depending on how fast the failover job (active commit) runs, there is a chance of two bad things happening: 1) replication_done can be called after the secondary has been closed and hence when the BDRVReplicationState is not valid anymore. 2) two copies of the active disk are present during the /replication/secondary/stop test (that test runs immediately after /replication/secondary/start, which tests failover). This causes the corruption detector to fire. Reviewed-by: Wen Congyang <wency@cn.fujitsu.com> Reviewed-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Message-Id: <1477565348-5458-2-git-send-email-pbonzini@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com>
This commit is contained in:
parent
9879b75873
commit
50ab0e0908
@ -138,6 +138,9 @@ static void replication_close(BlockDriverState *bs)
|
|||||||
if (s->replication_state == BLOCK_REPLICATION_RUNNING) {
|
if (s->replication_state == BLOCK_REPLICATION_RUNNING) {
|
||||||
replication_stop(s->rs, false, NULL);
|
replication_stop(s->rs, false, NULL);
|
||||||
}
|
}
|
||||||
|
if (s->replication_state == BLOCK_REPLICATION_FAILOVER) {
|
||||||
|
block_job_cancel_sync(s->active_disk->bs->job);
|
||||||
|
}
|
||||||
|
|
||||||
if (s->mode == REPLICATION_MODE_SECONDARY) {
|
if (s->mode == REPLICATION_MODE_SECONDARY) {
|
||||||
g_free(s->top_id);
|
g_free(s->top_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user