[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 2/6] iothread: Make iothread_stop() idempotent
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 2/6] iothread: Make iothread_stop() idempotent |
Date: |
Tue, 3 Oct 2017 12:28:37 +0200 |
From: Eduardo Habkost <address@hidden>
Currently, iothread_stop_all() makes all iothread objects unsafe
to be destroyed, because qemu_thread_join() ends up being called
twice.
To fix this, make iothread_stop() idempotent by checking
thread->stopped.
Fixes the following crash:
qemu-system-x86_64 -object iothread,id=iothread0 -monitor stdio -display none
QEMU 2.10.50 monitor - type 'help' for more information
(qemu) quit
qemu: qemu_thread_join: No such process
Aborted (core dumped)
Reported-by: Christian Borntraeger <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
iothread.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/iothread.c b/iothread.c
index 44c8944..59d0850 100644
--- a/iothread.c
+++ b/iothread.c
@@ -85,7 +85,7 @@ static int iothread_stop(Object *object, void *opaque)
IOThread *iothread;
iothread = (IOThread *)object_dynamic_cast(object, TYPE_IOTHREAD);
- if (!iothread || !iothread->ctx) {
+ if (!iothread || !iothread->ctx || iothread->stopping) {
return 0;
}
iothread->stopping = true;
--
1.8.3.1
- [Qemu-devel] [PULL 0/6] Misc patches for 2017-10-03, Paolo Bonzini, 2017/10/03
- [Qemu-devel] [PULL 1/6] scsi: Ignore executable for in-tree builds, Paolo Bonzini, 2017/10/03
- [Qemu-devel] [PULL 2/6] iothread: Make iothread_stop() idempotent,
Paolo Bonzini <=
- [Qemu-devel] [PULL 4/6] kvm: check KVM_CAP_SYNC_MMU with kvm_vm_check_extension(), Paolo Bonzini, 2017/10/03
- [Qemu-devel] [PULL 3/6] linux-headers: sync against v4.14-rc1, Paolo Bonzini, 2017/10/03
- [Qemu-devel] [PULL 6/6] kvmclock: use the updated system_timer_msr, Paolo Bonzini, 2017/10/03
- [Qemu-devel] [PULL 5/6] kvm: check KVM_CAP_NR_VCPUS with kvm_vm_check_extension(), Paolo Bonzini, 2017/10/03
- Re: [Qemu-devel] [PULL 0/6] Misc patches for 2017-10-03, Peter Maydell, 2017/10/03