From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56882) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAFRN-0008I8-7j for qemu-devel@nongnu.org; Wed, 01 Jul 2015 06:40:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZAFRM-0002gh-GO for qemu-devel@nongnu.org; Wed, 01 Jul 2015 06:40:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42655) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAFRM-0002gb-7T for qemu-devel@nongnu.org; Wed, 01 Jul 2015 06:40:28 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id DA1A2359D3C for ; Wed, 1 Jul 2015 10:40:27 +0000 (UTC) From: Juan Quintela Date: Wed, 1 Jul 2015 12:39:45 +0200 Message-Id: <1435747190-18017-22-git-send-email-quintela@redhat.com> In-Reply-To: <1435747190-18017-1-git-send-email-quintela@redhat.com> References: <1435747190-18017-1-git-send-email-quintela@redhat.com> Subject: [Qemu-devel] [PULL 21/26] 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