On Mon, Sep 24, 2012 at 02:57:35PM +0200, Peter Krempa wrote:
In most of the snapshot API's there's no need to hold the
driver lock
the whole time.
This patch adds helper functions that get the domain object in functions
that don't require the driver lock and simplifies call paths from
snapshot-related API's.
---
src/conf/domain_conf.c | 3 +-
src/qemu/qemu_driver.c | 306 +++++++++++++++----------------------------------
2 files changed, 94 insertions(+), 215 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 4aa08d0..2e1c86b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14372,7 +14372,8 @@ void virDomainObjLock(virDomainObjPtr obj)
void virDomainObjUnlock(virDomainObjPtr obj)
{
- virMutexUnlock(&obj->lock);
+ if (obj)
+ virMutexUnlock(&obj->lock);
}
I'm not really a fan of this change. IMHO when dealing with locking
it is good practice for callers to be fully aware of whether they
are dealing with NULL objects or not, and not let them be lazy about
it.
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|