On Mon, 09/18 18:53, Max Reitz wrote: > >> + > >> + if sync_source_and_target: > >> + # If source and target should be in sync after the mirror, > >> + # we have to flush before completion > > > > Not sure I understand this requirements, does it apply to libvirt and user > > too? > > I.e. it's a part of the interface ? Why cannot mirror_complete do it > > automatically? > > Well, it seems to pass without this flush, but the original intention > was this: When mirror is completed, the source node is replaced by the > target. All further writes are then only executed on the (former) > target node. So what might happen (or at least I think it could) is > that qemu-io submits some writes, but before they are actually > performed, the mirror block job is completed and the source is replaced > by the target. Then, the write operations are performed on the target > but no longer on the source, so source and target are then out of sync. > For the mirror block job, that is fine -- at the point of completion, > source and target were in sync. The job doesn't care that they get out > of sync after completion. But here, we have to care or we can't compare > source and target. > > The reason for why it always seems to pass without a flush is that every > submitted write is actually sent to the mirror node before it yields for > the first time. But I wouldn't bet on that, so I think it's better to > keep the flush before completing the block job.
OK, that makes sense. Thanks. Fam