From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38875) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z52VA-0005P2-8A for qemu-devel@nongnu.org; Tue, 16 Jun 2015 21:50:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z52V5-0004fm-TU for qemu-devel@nongnu.org; Tue, 16 Jun 2015 21:50:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49081) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z52V5-0004ck-Dv for qemu-devel@nongnu.org; Tue, 16 Jun 2015 21:50:47 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 0E40F3AB592 for ; Wed, 17 Jun 2015 01:50:47 +0000 (UTC) From: Juan Quintela Date: Wed, 17 Jun 2015 03:50:29 +0200 Message-Id: <1434505833-11234-8-git-send-email-quintela@redhat.com> In-Reply-To: <1434505833-11234-1-git-send-email-quintela@redhat.com> References: <1434505833-11234-1-git-send-email-quintela@redhat.com> Subject: [Qemu-devel] [PATCH 07/11] 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 --- migration/migration.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index f1ecf76..1791185 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -505,7 +505,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