From patchwork Fri Feb 22 16:36:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 222560 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 841072C0298 for ; Sat, 23 Feb 2013 03:46:58 +1100 (EST) Received: from localhost ([::1]:53194 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8vcp-0004C4-3x for incoming@patchwork.ozlabs.org; Fri, 22 Feb 2013 11:37:31 -0500 Received: from eggs.gnu.org ([208.118.235.92]:58612) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8vcX-0003pL-Gd for qemu-devel@nongnu.org; Fri, 22 Feb 2013 11:37:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U8vcT-0006f0-3Q for qemu-devel@nongnu.org; Fri, 22 Feb 2013 11:37:10 -0500 Received: from mail-vc0-f172.google.com ([209.85.220.172]:33216) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8vcS-0006ev-T5 for qemu-devel@nongnu.org; Fri, 22 Feb 2013 11:37:09 -0500 Received: by mail-vc0-f172.google.com with SMTP id l6so519396vcl.31 for ; Fri, 22 Feb 2013 08:37:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=wQgV83qHilDuzn3YNNiaIYmBnJBdK8dFBbFGTGy3Ot4=; b=0y/h6XR+N391Z9ELj7FN87cbTNwfu8MT4iuqj2noJIAl3NCkc4vFgls0Jqt7q+ge5p zTQwBUv/hH9UtJ20SERnj5fDPPn2MsXp6NwCyl/0wn5MuowTJZmAM/rhIMw26/CofDBg 305+aTwVETk0cTqjZVUcvdfK9wKFQ7k5HM/Bwa/EsK5XJa5w+z0QyOrCTPVWsuNqQKy0 eldZBSED8qslaFOarFL7qYGC8XVl/Qo6nHbU9lGgjToNPsEPJb2ijMgxDO/kO6cBqnwr zQ9KM9Q/BdhlDNIip0Ia9b8IddnfeqQ1Jf3fQ+xDrwzdf3IuOkLX+7hASJGDpZ+FwTq3 Kqww== X-Received: by 10.52.96.134 with SMTP id ds6mr2902814vdb.107.1361551028398; Fri, 22 Feb 2013 08:37:08 -0800 (PST) Received: from yakj.usersys.redhat.com (93-34-179-137.ip50.fastwebnet.it. [93.34.179.137]) by mx.google.com with ESMTPS id tp10sm4291733vec.1.2013.02.22.08.37.06 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 22 Feb 2013 08:37:07 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 22 Feb 2013 17:36:10 +0100 Message-Id: <1361551008-12430-5-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1361551008-12430-1-git-send-email-pbonzini@redhat.com> References: <1361551008-12430-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.220.172 Cc: owasserm@redhat.com, quintela@redhat.com Subject: [Qemu-devel] [PATCH 04/42] migration: push qemu_savevm_state_cancel out of qemu_savevm_state_* 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 This is useful, because it lets us keep the cancellation callbacks inside the big lock while pushing the others out. Reviewed-by: Orit Wasserman Reviewed-by: Juan Quintela Signed-off-by: Paolo Bonzini --- savevm.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/savevm.c b/savevm.c index a8a53ef..4302903 100644 --- a/savevm.c +++ b/savevm.c @@ -1621,17 +1621,11 @@ int qemu_savevm_state_begin(QEMUFile *f, ret = se->ops->save_live_setup(f, se->opaque); if (ret < 0) { - qemu_savevm_state_cancel(); return ret; } } ret = qemu_file_get_error(f); - if (ret != 0) { - qemu_savevm_state_cancel(); - } - return ret; - } /* @@ -1677,9 +1671,6 @@ int qemu_savevm_state_iterate(QEMUFile *f) return ret; } ret = qemu_file_get_error(f); - if (ret != 0) { - qemu_savevm_state_cancel(); - } return ret; } @@ -1778,8 +1769,7 @@ static int qemu_savevm_state(QEMUFile *f) }; if (qemu_savevm_state_blocked(NULL)) { - ret = -EINVAL; - goto out; + return -EINVAL; } ret = qemu_savevm_state_begin(f, ¶ms); @@ -1798,6 +1788,9 @@ out: if (ret == 0) { ret = qemu_file_get_error(f); } + if (ret != 0) { + qemu_savevm_state_cancel(); + } return ret; }