|
|
4a2fec |
From aad2de527db618942ce1f5cad0d9c2e29ec42f2e Mon Sep 17 00:00:00 2001
|
|
|
4a2fec |
From: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
4a2fec |
Date: Thu, 19 Oct 2017 01:34:50 +0200
|
|
|
4a2fec |
Subject: [PATCH 61/69] iothread: Make iothread_stop() idempotent
|
|
|
4a2fec |
|
|
|
4a2fec |
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
4a2fec |
Message-id: <20171019013453.21449-2-ehabkost@redhat.com>
|
|
|
4a2fec |
Patchwork-id: 77367
|
|
|
4a2fec |
O-Subject: [RHV7.5 qemu-kvm-rhev PATCH 1/4] iothread: Make iothread_stop() idempotent
|
|
|
4a2fec |
Bugzilla: 1460848
|
|
|
4a2fec |
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
4a2fec |
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
|
|
|
4a2fec |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
4a2fec |
|
|
|
4a2fec |
Currently, iothread_stop_all() makes all iothread objects unsafe
|
|
|
4a2fec |
to be destroyed, because qemu_thread_join() ends up being called
|
|
|
4a2fec |
twice.
|
|
|
4a2fec |
|
|
|
4a2fec |
To fix this, make iothread_stop() idempotent by checking
|
|
|
4a2fec |
thread->stopped.
|
|
|
4a2fec |
|
|
|
4a2fec |
Fixes the following crash:
|
|
|
4a2fec |
|
|
|
4a2fec |
qemu-system-x86_64 -object iothread,id=iothread0 -monitor stdio -display none
|
|
|
4a2fec |
QEMU 2.10.50 monitor - type 'help' for more information
|
|
|
4a2fec |
(qemu) quit
|
|
|
4a2fec |
qemu: qemu_thread_join: No such process
|
|
|
4a2fec |
Aborted (core dumped)
|
|
|
4a2fec |
|
|
|
4a2fec |
Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
|
|
|
4a2fec |
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
4a2fec |
Message-Id: <20170926130028.12471-1-ehabkost@redhat.com>
|
|
|
4a2fec |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
4a2fec |
(cherry picked from commit 65072c157e466db2785748a929e775703b20eefe)
|
|
|
4a2fec |
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
4a2fec |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
4a2fec |
---
|
|
|
4a2fec |
iothread.c | 2 +-
|
|
|
4a2fec |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
4a2fec |
|
|
|
4a2fec |
diff --git a/iothread.c b/iothread.c
|
|
|
4a2fec |
index beeb870..d67bdd4 100644
|
|
|
4a2fec |
--- a/iothread.c
|
|
|
4a2fec |
+++ b/iothread.c
|
|
|
4a2fec |
@@ -68,7 +68,7 @@ static int iothread_stop(Object *object, void *opaque)
|
|
|
4a2fec |
IOThread *iothread;
|
|
|
4a2fec |
|
|
|
4a2fec |
iothread = (IOThread *)object_dynamic_cast(object, TYPE_IOTHREAD);
|
|
|
4a2fec |
- if (!iothread || !iothread->ctx) {
|
|
|
4a2fec |
+ if (!iothread || !iothread->ctx || iothread->stopping) {
|
|
|
4a2fec |
return 0;
|
|
|
4a2fec |
}
|
|
|
4a2fec |
iothread->stopping = true;
|
|
|
4a2fec |
--
|
|
|
4a2fec |
1.8.3.1
|
|
|
4a2fec |
|