]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commit
conf: Refactor domain list collection critical section
authorPeter Krempa <pkrempa@redhat.com>
Wed, 29 Apr 2015 12:11:09 +0000 (14:11 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 11 May 2015 06:28:54 +0000 (08:28 +0200)
commitcbe7bbf722a4c5b276238d4cc50c2ac5d407f800
tree6819584689b6c32e667884b4653fbe654c323e5f
parent7906d5fbbba1229f10777f581f91a30063d48847
conf: Refactor domain list collection critical section

Until now the virDomainListAllDomains API would lock the domain list and
then every single domain object to access and filter it. This would
potentially allow a unresponsive VM to block the whole daemon if a
*listAllDomains call would get stuck.

To avoid this problem this patch collects a list of referenced domain
objects first from the list and then unlocks it right away. The
expensive operation requiring locking of the domain object is executed
after the list lock is dropped. While a single blocked domain will still
lock up a listAllDomains call, the domain list won't be held locked and
thus other APIs won't be blocked.

Additionally this patch also fixes the lookup code, where we'd ignore
the vm->removing flag and thus potentially return domain objects that
would be deleted very soon so calling any API wouldn't make sense.

As other clients also could benefit from operating on a list of domain
objects rather than the public domain descriptors a new intermediate
API - virDomainObjListCollect - is introduced by this patch.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1181074
src/conf/domain_conf.c
src/conf/domain_conf.h
src/libvirt_private.syms