From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58354) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S39HN-0007KR-Rk for qemu-devel@nongnu.org; Thu, 01 Mar 2012 11:55:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S39HH-00026a-7x for qemu-devel@nongnu.org; Thu, 01 Mar 2012 11:54:57 -0500 Message-ID: <4F4FAA9F.4040004@redhat.com> Date: Thu, 01 Mar 2012 17:58:07 +0100 From: Kevin Wolf MIME-Version: 1.0 References: <1330348561-9340-1-git-send-email-stefanha@linux.vnet.ibm.com> <4F4F9F91.8080501@redhat.com> <20120301162236.GA29196@stefanha-thinkpad.localdomain> In-Reply-To: <20120301162236.GA29196@stefanha-thinkpad.localdomain> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] qed: do not evict in-use L2 table cache entries List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: qemu-devel@nongnu.org, qemu-stable@nongnu.org Am 01.03.2012 17:22, schrieb Stefan Hajnoczi: > On Thu, Mar 01, 2012 at 05:10:57PM +0100, Kevin Wolf wrote: >> Am 27.02.2012 14:16, schrieb Stefan Hajnoczi: >>> The L2 table cache reduces QED metadata reads that would be required >>> when translating LBAs to offsets into the image file. Since requests >>> execute in parallel it is possible to share an L2 table between multi= ple >>> requests. >>> >>> There is a potential data corruption issue when an in-use L2 table is >>> evicted from the cache because the following situation occurs: >>> >>> 1. An allocating write performs an update to L2 table "A". >>> >>> 2. Another request needs L2 table "B" and causes table "A" to be >>> evicted. >>> >>> 3. A new read request needs L2 table "A" but it is not cached. >>> >>> As a result the L2 update from #1 can overlap with the L2 fetch from = #3. >>> We must avoid doing overlapping I/O requests here since the worst cas= e >>> outcome is that the L2 fetch completes before the L2 update and yield= s >>> stale data. In that case we would effectively discard the L2 update = and >>> lose data clusters! >>> >>> Thanks to Beno=EEt Canet for extensive testi= ng >>> and debugging which lead to discovery of this bug. >>> >>> Reported-by: Beno=EEt Canet >>> Signed-off-by: Stefan Hajnoczi >> >> Thanks, applied to the block branch. >> >> How about a qemu-iotests case? >=20 > The test case is not ready yet. I started writing one but it is racy > because I haven't introduced a way of controlling AIO issue/complete fo= r > tests. My next step is to add that. Will it be specific to image formats using AIO then or is it generic enough that coroutine-based drivers work with it as well? Kevin