From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:56572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S33oK-0004mJ-Eu for qemu-devel@nongnu.org; Thu, 01 Mar 2012 06:05:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S33oE-00023N-2Q for qemu-devel@nongnu.org; Thu, 01 Mar 2012 06:04:36 -0500 MIME-Version: 1.0 In-Reply-To: <1330348561-9340-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1330348561-9340-1-git-send-email-stefanha@linux.vnet.ibm.com> Date: Thu, 1 Mar 2012 11:04:25 +0000 Message-ID: From: Stefan Hajnoczi 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: =?ISO-8859-1?Q?Beno=EEt_Canet?= Cc: Kevin Wolf , qemu-devel@nongnu.org, qemu-stable@nongnu.org On Mon, Feb 27, 2012 at 1:16 PM, Stefan Hajnoczi wrote: > The L2 table cache reduces QED metadata reads that would be required > when translating LBAs to offsets into the image file. =A0Since requests > execute in parallel it is possible to share an L2 table between multiple > requests. > > There is a potential data corruption issue when an in-use L2 table is > evicted from the cache because the following situation occurs: > > =A01. An allocating write performs an update to L2 table "A". > > =A02. Another request needs L2 table "B" and causes table "A" to be > =A0 =A0 evicted. > > =A03. 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 case > outcome is that the L2 fetch completes before the L2 update and yields > stale data. =A0In that case we would effectively discard the L2 update an= d > lose data clusters! > > Thanks to Beno=EEt Canet for extensive testing > and debugging which lead to discovery of this bug. > > Reported-by: Beno=EEt Canet > Signed-off-by: Stefan Hajnoczi > --- > Please include this in -stable once it has been merged into qemu.git/mast= er. > > =A0block/qed-l2-cache.c | =A0 22 ++++++++++++++++++---- > =A01 files changed, 18 insertions(+), 4 deletions(-) Thanks for testing this fix and confirming it works, Beno=EEt. Feel free to reply with your Tested-by: line. Stefan