Am 28.08.2013 um 16:55 hat Max Reitz geschrieben: > The pre-write overlap check function is now called before most of the > qcow2 writes (aborting it on collision or other error). > > Signed-off-by: Max Reitz <mre...@redhat.com> > --- > block/qcow2-cache.c | 17 +++++++++++++++++ > block/qcow2-cluster.c | 21 +++++++++++++++++++++ > block/qcow2-snapshot.c | 22 ++++++++++++++++++++++ > block/qcow2.c | 36 +++++++++++++++++++++++++++++++++++- > 4 files changed, 95 insertions(+), 1 deletion(-)
> @@ -1753,10 +1779,18 @@ static int qcow2_save_vmstate(BlockDriverState *bs, > QEMUIOVector *qiov, > BDRVQcowState *s = bs->opaque; > int growable = bs->growable; > int ret; > + int64_t offset = qcow2_vm_state_offset(s) + pos; > > BLKDBG_EVENT(bs->file, BLKDBG_VMSTATE_SAVE); > bs->growable = 1; > - ret = bdrv_pwritev(bs, qcow2_vm_state_offset(s) + pos, qiov); > + > + ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT, offset, > + qiov->size); > + if (ret < 0) { > + return ret; > + } > + > + ret = bdrv_pwritev(bs, offset, qiov); > bs->growable = growable; > > return ret; Sorry for not catching it in v1, this one is actually wrong. The bdrv_pwritev() is against bs, not bs->file, so you would be comparing virtual/guest offsets with physical/host offsets. I think you can simply leave the check out here, the one in qcow2_co_writev() should already do the right thing inside bdrv_pwritev(). Kevin