From patchwork Tue Jul 20 09:19:00 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshiaki Tamura X-Patchwork-Id: 59289 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 357A4B6EEB for ; Tue, 20 Jul 2010 19:24:02 +1000 (EST) Received: from localhost ([127.0.0.1]:37593 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ob93O-0007tk-FH for incoming@patchwork.ozlabs.org; Tue, 20 Jul 2010 05:23:58 -0400 Received: from [140.186.70.92] (port=41789 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ob91L-0007RN-KI for qemu-devel@nongnu.org; Tue, 20 Jul 2010 05:21:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ob91K-0007tP-EF for qemu-devel@nongnu.org; Tue, 20 Jul 2010 05:21:51 -0400 Received: from sh.osrg.net ([192.16.179.4]:43930) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ob91J-0007rv-Un for qemu-devel@nongnu.org; Tue, 20 Jul 2010 05:21:50 -0400 Received: from fs.osrg.net (postfix@fs.osrg.net [10.0.0.12]) by sh.osrg.net (8.14.3/8.14.3/OSRG-NET) with ESMTP id o6K9Lg5Z024403; Tue, 20 Jul 2010 18:21:42 +0900 Received: from localhost (hype-nh0.osrg.net [10.72.1.48]) by fs.osrg.net (Postfix) with ESMTP id 9D0303E027C; Tue, 20 Jul 2010 18:21:42 +0900 (JST) From: Yoshiaki Tamura To: qemu-devel@nongnu.org Date: Tue, 20 Jul 2010 18:19:00 +0900 Message-Id: <1279617540-17240-1-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> X-Mailer: git-send-email 1.7.1.1 X-Dispatcher: imput version 20070423(IM149) Lines: 38 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (sh.osrg.net [192.16.179.4]); Tue, 20 Jul 2010 18:21:43 +0900 (JST) X-Virus-Scanned: clamav-milter 0.96.1 at sh X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: kwolf@redhat.com, Yoshiaki Tamura Subject: [Qemu-devel] [PATCH] 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 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 --- 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");