From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=46204 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OOU0R-00030U-IO for qemu-devel@nongnu.org; Tue, 15 Jun 2010 07:08:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OOU0P-0005qD-73 for qemu-devel@nongnu.org; Tue, 15 Jun 2010 07:08:35 -0400 Received: from mail-vw0-f45.google.com ([209.85.212.45]:60336) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OOU0P-0005q5-45 for qemu-devel@nongnu.org; Tue, 15 Jun 2010 07:08:33 -0400 Received: by vws17 with SMTP id 17so1229212vws.4 for ; Tue, 15 Jun 2010 04:08:32 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1276598178-16798-1-git-send-email-kwolf@redhat.com> References: <1276598178-16798-1-git-send-email-kwolf@redhat.com> Date: Tue, 15 Jun 2010 12:08:32 +0100 Message-ID: From: Stefan Hajnoczi Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] Re: [PATCH v2 1/2] qcow2: Simplify image creation List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org On Tue, Jun 15, 2010 at 11:36 AM, Kevin Wolf wrote: > + =A0 =A0/* > + =A0 =A0 * And now open the image and make it consistent first (i.e. inc= rease the > + =A0 =A0 * refcount of the cluster that is occupied by the header and th= e refcount > + =A0 =A0 * table) > + =A0 =A0 */ > + =A0 =A0BlockDriver* drv =3D bdrv_find_format("qcow2"); > + =A0 =A0assert(drv !=3D NULL); > + =A0 =A0ret =3D bdrv_open(bs, filename, BDRV_O_RDWR | BDRV_O_NO_FLUSH, d= rv); > + =A0 =A0if (ret < 0) { > + =A0 =A0 =A0 =A0goto out; > + =A0 =A0} Here I think we should really return directly on error. bdrv_delete(bs) doesn't work since bs isn't initialized when bdrv_open() fails. Stefan