]> git.ipfire.org Git - thirdparty/libvirt.git/commit
remote_daemon: Set shutdown callbacks only after init is done
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 9 Dec 2021 14:29:43 +0000 (15:29 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 10 Dec 2021 12:51:01 +0000 (13:51 +0100)
commit05e518f47a78d4d54ac030c5c9e3e8e5877776c9
tree01160ef41f19d00fbd851278c99fd6686fff69c1
parent6e6a11bc0ace26f41bbb81656268bf8a5d042bb0
remote_daemon: Set shutdown callbacks only after init is done

The initialization of drivers happens in a separate thread.
However, the main thread continues initialization and sets
shutdown callbacks (virStateShutdownPrepare() and
virStateShutdownWait()) even though the driver init thread is
still running. This is dangerous because if the daemon decides to
quit early (e.g. because SIGINT was delivered) the
shutdownPrepare and shutdownWait callback are called over
partially init drivers.

Set callbacks only after all drivers were initialized.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/218
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2027400

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/remote/remote_daemon.c