diff options
author | Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com> | 2016-05-17 14:44:46 +0300 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2016-05-26 08:25:40 -0400 |
commit | 3ba93c754bc875a2b5f1baf65ca5ba704beb0bc5 (patch) | |
tree | 1244c2b6b1778c9fa0b1e29aa64739b713b7ab48 | |
parent | f8f7440870192b004539b651f7839b4f4c62db2d (diff) | |
download | libvirt-3ba93c754bc875a2b5f1baf65ca5ba704beb0bc5.tar.gz |
daemon: cleanup state drivers in order reverse to init order
This patch aims to fix observed crash on daemon shutdown. Main thread is in
the process of state drivers cleanup, network driver is cleaned up and
qemu driver is not yet. Meanwhile eof event from qemu process triggers
qemuProcessStop -> networkReleaseActualDevice and crash happens as
network driver is already cleaned up.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
-rw-r--r-- | src/libvirt.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libvirt.c b/src/libvirt.c index 0e7e435bbf..6d9dba8887 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -799,12 +799,12 @@ virStateInitialize(bool privileged, int virStateCleanup(void) { - size_t i; + int r; int ret = 0; - for (i = 0; i < virStateDriverTabCount; i++) { - if (virStateDriverTab[i]->stateCleanup && - virStateDriverTab[i]->stateCleanup() < 0) + for (r = virStateDriverTabCount - 1; r >= 0; r--) { + if (virStateDriverTab[r]->stateCleanup && + virStateDriverTab[r]->stateCleanup() < 0) ret = -1; } return ret; |