From e04d3390bbc245a2264c49ed1641d57dcd49fce5 Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Mon, 13 Jul 2015 13:42:05 +0200 Subject: [PATCH 25/58] migration: Use cmpxchg correctly Message-id: <1436794926-1598-17-git-send-email-dgilbert@redhat.com> Patchwork-id: 66984 O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 16/17] migration: Use cmpxchg correctly Bugzilla: 1210715 RH-Acked-by: Marcel Apfelbaum RH-Acked-by: Laszlo Ersek RH-Acked-by: Juan Quintela From: Juan Quintela cmpxchg returns the old value Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert (cherry picked from commit a5c17b5f68ff7e37ce6e6e1f5457307fe07629e7) Signed-off-by: Miroslav Rezanina --- migration/migration.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index 8216044..eefbd18 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -289,7 +289,7 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params, 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); } } -- 1.8.3.1