From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M1kcN-0003o9-Qv for qemu-devel@nongnu.org; Wed, 06 May 2009 13:09:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M1kcJ-0003ne-06 for qemu-devel@nongnu.org; Wed, 06 May 2009 13:09:15 -0400 Received: from [199.232.76.173] (port=55251 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M1kcI-0003nb-QQ for qemu-devel@nongnu.org; Wed, 06 May 2009 13:09:10 -0400 Received: from mx2.redhat.com ([66.187.237.31]:60519) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M1kcI-0006hZ-6i for qemu-devel@nongnu.org; Wed, 06 May 2009 13:09:10 -0400 Message-ID: <4A01C411.3060505@redhat.com> Date: Wed, 06 May 2009 20:08:33 +0300 From: Avi Kivity MIME-Version: 1.0 References: <1241627950-22195-1-git-send-email-kwolf@redhat.com> <4A01C0C6.7020902@redhat.com> <4A01C2D4.5070000@redhat.com> In-Reply-To: <4A01C2D4.5070000@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH] qcow2/virtio corruption: Don't allocate the same cluster twice List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: markmc@redhat.com, qemu-devel@nongnu.org Kevin Wolf wrote: > Avi Kivity schrieb: > >> What happens if the second request completes before the first? Then, >> when the first request completes, alloc_cluster_link_l2() will call >> copy_clusters() and overwrite the second request. >> > > Ouch, you're right. I should not only check if the image is consistent, > but also if the data survives. > > We really want qemu-io fsx. >> 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. -- Do not meddle in the internals of kernels, for they are subtle and quick to panic.