From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NXJAu-0004S9-KW for qemu-devel@nongnu.org; Tue, 19 Jan 2010 13:51:36 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NXJAq-0004QZ-TF for qemu-devel@nongnu.org; Tue, 19 Jan 2010 13:51:36 -0500 Received: from [199.232.76.173] (port=56313 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NXJAq-0004QQ-Mt for qemu-devel@nongnu.org; Tue, 19 Jan 2010 13:51:32 -0500 Received: from verein.lst.de ([213.95.11.210]:58596) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1NXJAq-0002w4-9Q for qemu-devel@nongnu.org; Tue, 19 Jan 2010 13:51:32 -0500 Date: Tue, 19 Jan 2010 19:51:28 +0100 From: Christoph Hellwig Subject: Re: [Qemu-devel] [PATCH 07/10] qcow2: Improve error handling in update_refcount Message-ID: <20100119185128.GA31526@lst.de> References: <1263816696-24122-1-git-send-email-kwolf@redhat.com> <1263816696-24122-8-git-send-email-kwolf@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1263816696-24122-8-git-send-email-kwolf@redhat.com> 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 Mon, Jan 18, 2010 at 01:11:33PM +0100, Kevin Wolf wrote: > If update_refcount fails, try to undo any changes made so far to avoid > inconsistencies in the image file. > > Signed-off-by: Kevin Wolf > --- > block/qcow2-refcount.c | 32 +++++++++++++++++++++++++------- > 1 files changed, 25 insertions(+), 7 deletions(-) > > + /* > + * Try do undo any updates if an error is returned (This may succeed in > + * some cases like ENOSPC for allocating a new refcount block) > + */ > + if (ret < 0) { > + int dummy; > + dummy = update_refcount(bs, offset, cluster_offset - offset, -addend); So we recursively call into update_refcount here. What happens an error causes all updates to fail?