migration: Use cmpxchg correctly
cmpxchg returns the old value Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
		
							parent
							
								
									61964c23e5
								
							
						
					
					
						commit
						a5c17b5f68
					
				| 
						 | 
				
			
			@ -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);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue