From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58013) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SFoqd-0000uL-QS for qemu-devel@nongnu.org; Thu, 05 Apr 2012 11:43:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SFoqP-0005YO-Pz for qemu-devel@nongnu.org; Thu, 05 Apr 2012 11:43:40 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:38009) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SFoqO-0005XY-JO for qemu-devel@nongnu.org; Thu, 05 Apr 2012 11:43:29 -0400 Received: by mail-pb0-f45.google.com with SMTP id uo5so1867471pbc.4 for ; Thu, 05 Apr 2012 08:43:24 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Thu, 5 Apr 2012 17:42:59 +0200 Message-Id: <1333640581-25649-6-git-send-email-pbonzini@redhat.com> In-Reply-To: <1333640581-25649-1-git-send-email-pbonzini@redhat.com> References: <1333640581-25649-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 5/7] block: pass new base image format to bdrv_change_backing_file List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org The format was not written to the image, only the file name. This will overwrite an auto-probe image with the right format. Format probing is unsafe and we want to avoid it whenever possible. An alternative would be to look out the backing file from the image above base. Signed-off-by: Paolo Bonzini --- block/stream.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/block/stream.c b/block/stream.c index 54f2b39..2b492d5 100644 --- a/block/stream.c +++ b/block/stream.c @@ -240,11 +240,14 @@ retry: } if (!block_job_is_cancelled(&s->common) && sector_num == end && ret == 0) { - const char *base_id = NULL; + const char *base_id = NULL, *base_fmt = NULL; if (base) { base_id = s->backing_file_id; + if (base->drv) { + base_fmt = base->drv->format_name; + } } - ret = bdrv_change_backing_file(bs, base_id, NULL); + ret = bdrv_change_backing_file(bs, base_id, base_fmt); close_unused_images(bs, base, base_id); } -- 1.7.9.3