From patchwork Mon Jul 26 14:01:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 59915 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 549BCB70A5 for ; Tue, 27 Jul 2010 00:03:18 +1000 (EST) Received: from localhost ([127.0.0.1]:48442 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OdOGx-0002SE-NC for incoming@patchwork.ozlabs.org; Mon, 26 Jul 2010 10:03:15 -0400 Received: from [140.186.70.92] (port=49904 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OdOFH-0002Ng-HG for qemu-devel@nongnu.org; Mon, 26 Jul 2010 10:01:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OdOF7-0005PN-Kf for qemu-devel@nongnu.org; Mon, 26 Jul 2010 10:01:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16728) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OdOF7-0005PC-E6 for qemu-devel@nongnu.org; Mon, 26 Jul 2010 10:01:21 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o6QE1Jtc020950 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 26 Jul 2010 10:01:19 -0400 Received: from dhcp-5-188.str.redhat.com (dhcp-5-175.str.redhat.com [10.32.5.175]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o6QE1FeS021114; Mon, 26 Jul 2010 10:01:18 -0400 From: Kevin Wolf To: anthony@codemonkey.ws Date: Mon, 26 Jul 2010 16:01:12 +0200 Message-Id: <1280152877-29037-3-git-send-email-kwolf@redhat.com> In-Reply-To: <1280152877-29037-1-git-send-email-kwolf@redhat.com> References: <1280152877-29037-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 2/7] block migration: propagate return value when bdrv_write() returns < 0 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Yoshiaki Tamura Currently block_load() doesn't check return value of bdrv_write(), and even the destination weren't prepared to execute block migration, it proceeds and guest boots on the target. This patch fix this issue. Signed-off-by: Yoshiaki Tamura Signed-off-by: Kevin Wolf --- block-migration.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/block-migration.c b/block-migration.c index a77106e..8eda307 100644 --- a/block-migration.c +++ b/block-migration.c @@ -586,6 +586,7 @@ static int block_load(QEMUFile *f, void *opaque, int version_id) addr >>= BDRV_SECTOR_BITS; if (flags & BLK_MIG_FLAG_DEVICE_BLOCK) { + int ret; /* get device name */ len = qemu_get_byte(f); qemu_get_buffer(f, (uint8_t *)device_name, len); @@ -601,9 +602,12 @@ static int block_load(QEMUFile *f, void *opaque, int version_id) buf = qemu_malloc(BLOCK_SIZE); qemu_get_buffer(f, buf, BLOCK_SIZE); - bdrv_write(bs, addr, buf, BDRV_SECTORS_PER_DIRTY_CHUNK); + ret = bdrv_write(bs, addr, buf, BDRV_SECTORS_PER_DIRTY_CHUNK); qemu_free(buf); + if (ret < 0) { + return ret; + } } else if (flags & BLK_MIG_FLAG_PROGRESS) { if (!banner_printed) { printf("Receiving block device images\n");