From patchwork Mon Oct 3 13:40:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 117446 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E15B8B6F6B for ; Tue, 4 Oct 2011 00:41:09 +1100 (EST) Received: from localhost ([::1]:60205 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RAilV-0003Tq-2X for incoming@patchwork.ozlabs.org; Mon, 03 Oct 2011 09:41:05 -0400 Received: from eggs.gnu.org ([140.186.70.92]:54468) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RAilP-0003Tl-0K for qemu-devel@nongnu.org; Mon, 03 Oct 2011 09:41:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RAilN-0002Vc-US for qemu-devel@nongnu.org; Mon, 03 Oct 2011 09:40:58 -0400 Received: from mail-yx0-f173.google.com ([209.85.213.173]:56591) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RAilN-0002VR-S0 for qemu-devel@nongnu.org; Mon, 03 Oct 2011 09:40:57 -0400 Received: by yxl11 with SMTP id 11so4654830yxl.4 for ; Mon, 03 Oct 2011 06:40:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=4rgWZS8wHuRlcx2EEfOzV0rXTmaSDJ1ha8iMn12dTXk=; b=GEPSXSV6xY3MMdGPf9Rb0KMLgdVgnDfUq1mAfYBHz3hViD0pG+G74Agm92Br7HJBSp GpqETiljDx9CULfoAalRgXCSoJSdL2qWhvAFdoCDHe3m8XRQfviAE92t8htcYkZVxlpj KFa+LUNWdE4By9HIrYokC2AjqmbsoI9s3mNNs= MIME-Version: 1.0 Received: by 10.236.79.72 with SMTP id h48mr89069303yhe.4.1317649257313; Mon, 03 Oct 2011 06:40:57 -0700 (PDT) Received: by 10.146.168.17 with HTTP; Mon, 3 Oct 2011 06:40:57 -0700 (PDT) In-Reply-To: References: <20111003075147.GB31578@stefanha-thinkpad.localdomain> Date: Mon, 3 Oct 2011 14:40:57 +0100 Message-ID: From: Stefan Hajnoczi To: nicolas prochazka X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.213.173 Cc: qemu-devel Subject: Re: [Qemu-devel] qcow2 corrupted image, no error from qemu-img check X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Mon, Oct 3, 2011 at 2:01 PM, nicolas prochazka wrote: > sorry to bother you, i send dump of two qemu-io command . > What can I do with this result ? The qemu-io -c read command was successful. This means that the I/O error was triggered by the specific request that qemu-img convert issued, not a general problem with the image file. It also means the image itself may not be corrupted at all - this could just be a bug in the qemu-img convert code. Thanks for collecting the qemu-io -c map output. The image file has clusters allocated around the offset where your I/O error was reported. There's nothing unusal in this output: [ 2768175104] 128/ 36536448 sectors allocated at offset 2.578 GiB (1) [ **2768240640**] 128/ 36536320 sectors allocated at offset 2.578 GiB (1) [ 2768306176] 128/ 36536192 sectors allocated at offset 2.578 GiB (1) [ 2768371712] 128/ 36536064 sectors allocated at offset 2.578 GiB (1) [ 2768437248] 128/ 36535936 sectors allocated at offset 2.578 GiB (1) [ 2768502784] 128/ 36535808 sectors allocated at offset 2.578 GiB (1) [ 2768568320] 128/ 36535680 sectors allocated at offset 2.578 GiB (1) > cp is working well but no qemu-img Good, so this looks like a QEMU bug. Try enhancing the error output like this: Perhaps one of the arguments is out of range. Are you comfortable applying this patch to qemu-img.c, rebuilding, and running the qemu-img convert again? Stefan diff --git a/qemu-img.c b/qemu-img.c index 6a39731..c300164 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -1010,8 +1010,9 @@ static int img_convert(int argc, char **argv) ret = bdrv_read(bs[bs_i], sector_num - bs_offset, buf, n); if (ret < 0) { - error_report("error while reading sector %" PRId64 ": %s", - sector_num - bs_offset, strerror(-ret)); + error_report("error while reading bs_i %d sector_num %" + PRId64 " bs_offset %" PRId64 " n %d: %s", + bs_i, sector_num, bs_offset, n, strerror(-ret)); goto out; } /* NOTE: at the same time we convert, we do not write zero