From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55667) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNM63-0008A4-CL for qemu-devel@nongnu.org; Tue, 11 Mar 2014 08:47:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WNM5y-000478-1h for qemu-devel@nongnu.org; Tue, 11 Mar 2014 08:47:51 -0400 Received: from mail-ea0-x234.google.com ([2a00:1450:4013:c01::234]:45959) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNM5x-000474-R8 for qemu-devel@nongnu.org; Tue, 11 Mar 2014 08:47:45 -0400 Received: by mail-ea0-f180.google.com with SMTP id m10so4291790eaj.11 for ; Tue, 11 Mar 2014 05:47:44 -0700 (PDT) Date: Tue, 11 Mar 2014 13:47:41 +0100 From: Stefan Hajnoczi Message-ID: <20140311124741.GC7761@stefanha-thinkpad.redhat.com> References: <1394531919-14346-1-git-send-email-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1394531919-14346-1-git-send-email-kwolf@redhat.com> Subject: Re: [Qemu-devel] [PATCH] block: Update image size in bdrv_invalidate_cache() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org, stefanha@redhat.com, quintela@redhat.com On Tue, Mar 11, 2014 at 10:58:39AM +0100, Kevin Wolf wrote: > After migration has completed, we call bdrv_invalidate_cache() so that > drivers which cache some data drop their stale copy of the data and > reread it from the image file to get a new version of data that the > source modified while the migration was running. > > Reloading metadata from the image file is useless, though, if the size > of the image file stays stale (this is a value that is cached for all > image formats in block.c). Reads from (meta)data after the old EOF > return only zeroes, causing image corruption. > > We need to update bs->total_sectors in all layers that could potentially > have changed their size (i.e. backing files are not a concern - if they > are changed, we're in bigger trouble) > > Signed-off-by: Kevin Wolf > --- > block.c | 10 +++++++++- > block/qcow2.c | 2 ++ > block/qed.c | 3 +++ > 3 files changed, 14 insertions(+), 1 deletion(-) Thanks, applied to my block tree: https://github.com/stefanha/qemu/commits/block Stefan