summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorEmilio G. Cota <cota@braap.org>2015-08-23 20:23:37 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2015-09-09 15:34:54 +0200
commit5243722376873a48e9852a58b91f4d4101ee66e4 (patch)
tree310a56c79e1e5d6d4119ccf706abeeffdb1939c7 /util
parent12a1ddc160cb6a73e8a6c319f3962a20da2cd22f (diff)
downloadhqemu-5243722376873a48e9852a58b91f4d4101ee66e4.zip
hqemu-5243722376873a48e9852a58b91f4d4101ee66e4.tar.gz
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>
Diffstat (limited to 'util')
-rw-r--r--util/rcu.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/util/rcu.c b/util/rcu.c
index 8ba304d..47c2bce 100644
--- a/util/rcu.c
+++ b/util/rcu.c
@@ -335,6 +335,11 @@ static void rcu_init_unlock(void)
qemu_mutex_unlock(&rcu_registry_lock);
qemu_mutex_unlock(&rcu_sync_lock);
}
+
+static void rcu_init_child(void)
+{
+ qemu_mutex_init(&rcu_registry_lock);
+}
#endif
void rcu_after_fork(void)
@@ -346,7 +351,7 @@ void rcu_after_fork(void)
static void __attribute__((__constructor__)) rcu_init(void)
{
#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
rcu_init_complete();
}
OpenPOWER on IntegriCloud