Received: from eggs.gnu.org ([2001:4830:134:3::10]:49676) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCSd4-0004zK-Me for qemu-devel@nongnu.org; Tue, 07 Jul 2015 09:09:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZCSd3-0003T1-JT for qemu-devel@nongnu.org; Tue, 07 Jul 2015 09:09:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38863) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCSd3-0003Sj-Eq for qemu-devel@nongnu.org; Tue, 07 Jul 2015 09:09:41 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 37AAF14AA6 for ; Tue, 7 Jul 2015 13:09:41 +0000 (UTC) From: Juan Quintela Date: Tue, 7 Jul 2015 15:09:00 +0200 Message-Id: <1436274549-28826-20-git-send-email-quintela@redhat.com> In-Reply-To: <1436274549-28826-1-git-send-email-quintela@redhat.com> References: <1436274549-28826-1-git-send-email-quintela@redhat.com> Subject: [Qemu-devel] [PULL 19/28] migration: Use cmpxchg correctly List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: amit.shah@redhat.com cmpxchg returns the old value Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/migration.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index edb4f3e..1e34aa5 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -509,7 +509,7 @@ void qmp_migrate_set_parameters(bool has_compress_level, static void migrate_set_state(MigrationState *s, int old_state, int new_state) { - if (atomic_cmpxchg(&s->state, old_state, new_state) == new_state) { + if (atomic_cmpxchg(&s->state, old_state, new_state) == old_state) { trace_migrate_set_state(new_state); } } -- 2.4.3