From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43972) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEyMn-0000k0-OD for qemu-devel@nongnu.org; Thu, 29 Aug 2013 05:18:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VEyMh-000696-OX for qemu-devel@nongnu.org; Thu, 29 Aug 2013 05:18:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55897) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEyMh-000663-GZ for qemu-devel@nongnu.org; Thu, 29 Aug 2013 05:18:07 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7T9I6US024001 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 29 Aug 2013 05:18:06 -0400 Date: Thu, 29 Aug 2013 11:18:20 +0200 From: Kevin Wolf Message-ID: <20130829091820.GF2961@dhcp-200-207.str.redhat.com> References: <1377701706-965-1-git-send-email-mreitz@redhat.com> <1377701706-965-4-git-send-email-mreitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1377701706-965-4-git-send-email-mreitz@redhat.com> 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: Max Reitz Cc: qemu-devel@nongnu.org, Stefan Hajnoczi 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 = 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