From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M1lJZ-0004QC-ER for qemu-devel@nongnu.org; Wed, 06 May 2009 13:53:53 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M1lJV-0004P5-Rg for qemu-devel@nongnu.org; Wed, 06 May 2009 13:53:53 -0400 Received: from [199.232.76.173] (port=49888 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M1lJV-0004P2-Nb for qemu-devel@nongnu.org; Wed, 06 May 2009 13:53:49 -0400 Received: from mx2.redhat.com ([66.187.237.31]:54463) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M1lJV-0006NA-11 for qemu-devel@nongnu.org; Wed, 06 May 2009 13:53:49 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n46Hrm1P003624 for ; Wed, 6 May 2009 13:53:48 -0400 Message-ID: <4A01CE6C.3000901@redhat.com> Date: Wed, 06 May 2009 19:52:44 +0200 From: Kevin Wolf MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [PATCH] qcow2/virtio corruption: Don't allocate the same cluster twice References: <1241627950-22195-1-git-send-email-kwolf@redhat.com> <4A01C0C6.7020902@redhat.com> <4A01C2D4.5070000@redhat.com> <4A01C411.3060505@redhat.com> In-Reply-To: <4A01C411.3060505@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: markmc@redhat.com, qemu-devel@nongnu.org Avi Kivity schrieb: > Kevin Wolf wrote: >> Avi Kivity schrieb: >>> Also, the second request now depends on the first to update its >>> metadata. But if the first request fail, it will not update its >>> metadata, and the second request will complete without error and also >>> without updating its metadata. >>> >> Hm, right. Need to think about this... >> > > I suggest retaining the part where you use inflight l2metas to layout > data contiguously, but change alloc_cluster_link_l2() not to rely on > n_start and nb_available but instead recompute them on completion. > m->nb_clusters should never be zeroed for this to work. Is there even a reason why we need to copy the unmodified sectors in alloc_cluster_link_l2() and cannot do that in alloc_cluster_offset() before we write the new data? Then the callback wouldn't need to mess around with figuring out which part must be overwritten and which one mustn't. Kevin