提交 65072c15 编写于 作者: E Eduardo Habkost 提交者: Paolo Bonzini

iothread: Make iothread_stop() idempotent

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: NChristian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
Message-Id: <20170926130028.12471-1-ehabkost@redhat.com>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 cff3e8b8
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册