From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44319) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEyPA-0001oD-0j for qemu-devel@nongnu.org; Thu, 29 Aug 2013 05:20:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VEyP3-0006wE-42 for qemu-devel@nongnu.org; Thu, 29 Aug 2013 05:20:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:7763) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEyP2-0006w3-I2 for qemu-devel@nongnu.org; Thu, 29 Aug 2013 05:20:32 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7T9KVw8031583 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 29 Aug 2013 05:20:32 -0400 Message-ID: <521F125D.6020805@redhat.com> Date: Thu, 29 Aug 2013 11:20:29 +0200 From: Max Reitz MIME-Version: 1.0 References: <1377701706-965-1-git-send-email-mreitz@redhat.com> <1377701706-965-4-git-send-email-mreitz@redhat.com> <20130829091820.GF2961@dhcp-200-207.str.redhat.com> In-Reply-To: <20130829091820.GF2961@dhcp-200-207.str.redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 3/5] qcow2: Employ metadata overlap checks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org, Stefan Hajnoczi Am 29.08.2013 11:18, schrieb Kevin Wolf: > 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 >> --- >> 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 =3D bs->opaque; >> int growable =3D bs->growable; >> int ret; >> + int64_t offset =3D qcow2_vm_state_offset(s) + pos; >> =20 >> BLKDBG_EVENT(bs->file, BLKDBG_VMSTATE_SAVE); >> bs->growable =3D 1; >> - ret =3D bdrv_pwritev(bs, qcow2_vm_state_offset(s) + pos, qiov); >> + >> + ret =3D qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT, offse= t, >> + qiov->size); >> + if (ret < 0) { >> + return ret; >> + } >> + >> + ret =3D bdrv_pwritev(bs, offset, qiov); >> bs->growable =3D growable; >> =20 >> 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. Oh, yes, sorry; thanks for noticing. I do this mistake way too often =96 = I=20 think it's time for some regex to catch it=85 Max