rcu: init rcu_registry_lock after fork
We were unlocking this lock after fork, which is wrong since only the thread that holds a mutex is allowed to unlock it. Signed-off-by: Emilio G. Cota <cota@braap.org> Message-Id: <1440375847-17603-9-git-send-email-cota@braap.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
		
							parent
							
								
									12a1ddc160
								
							
						
					
					
						commit
						5243722376
					
				@ -335,6 +335,11 @@ static void rcu_init_unlock(void)
 | 
				
			|||||||
    qemu_mutex_unlock(&rcu_registry_lock);
 | 
					    qemu_mutex_unlock(&rcu_registry_lock);
 | 
				
			||||||
    qemu_mutex_unlock(&rcu_sync_lock);
 | 
					    qemu_mutex_unlock(&rcu_sync_lock);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void rcu_init_child(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    qemu_mutex_init(&rcu_registry_lock);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void rcu_after_fork(void)
 | 
					void rcu_after_fork(void)
 | 
				
			||||||
@ -346,7 +351,7 @@ void rcu_after_fork(void)
 | 
				
			|||||||
static void __attribute__((__constructor__)) rcu_init(void)
 | 
					static void __attribute__((__constructor__)) rcu_init(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
#ifdef CONFIG_POSIX
 | 
					#ifdef CONFIG_POSIX
 | 
				
			||||||
    pthread_atfork(rcu_init_lock, rcu_init_unlock, rcu_init_unlock);
 | 
					    pthread_atfork(rcu_init_lock, rcu_init_unlock, rcu_init_child);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
    rcu_init_complete();
 | 
					    rcu_init_complete();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user