From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37437) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNKzX-0000Ni-Qx for qemu-devel@nongnu.org; Tue, 11 Mar 2014 07:37:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WNKzR-0004mj-SO for qemu-devel@nongnu.org; Tue, 11 Mar 2014 07:37:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50324) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNKzR-0004mO-KH for qemu-devel@nongnu.org; Tue, 11 Mar 2014 07:36:57 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s2BBau9q024327 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 11 Mar 2014 07:36:56 -0400 From: Juan Quintela In-Reply-To: <1394531919-14346-1-git-send-email-kwolf@redhat.com> (Kevin Wolf's message of "Tue, 11 Mar 2014 10:58:39 +0100") References: <1394531919-14346-1-git-send-email-kwolf@redhat.com> Date: Tue, 11 Mar 2014 12:36:55 +0100 Message-ID: <87ha757yqw.fsf@elfo.mitica> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] block: Update image size in bdrv_invalidate_cache() Reply-To: quintela@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org, stefanha@redhat.com 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 Reviewed-by: Juan Quintela Tested-by: Juan Quintela I had problems with migration with qcow2 files, and this fixes it.