qemu: Add missing lock of virDomainObj before calling virDomainUnref
qemu: Add missing lock of virDomainObj before calling virDomainUnref

This was found while researching the root cause of:

https://bugzilla.redhat.com/show_bug.cgi?id=670848

virDomainUnref should only be called with the lock held for the
virDomainObj in question. However, when a transient qemu domain gets
EOF on its monitor socket, it queues an event which frees the monitor,
which unref's the virDomainObj without first locking it. If another
thread has already locked the virDomainObj, the modification of the
refcount could potentially be corrupted. In an extreme case, it could
also be potentially unlocked by virDomainObjFree, thus left open to
modification by anyone else who would have otherwise waited for the
lock (not to mention the fact that they would be accessing freed
data!).

The solution is to have qemuMonitorFree lock the domain object right
before unrefing it. Since the caller to qemuMonitorFree doesn't expect
this lock to be held, if the refcount doesn't go all the way to 0,
qemuMonitorFree must unlock it after the unref.

kantai/libvirt-vfork,rbu/libvirt,iam-TJ/libvirt,datto/libvirt,bjzhang/libvirt,andreabolognani/libvirt,rmarwaha/libvirt,wiedi/libvirt,elmarco/libvirt,iam-TJ/libvirt,elmarco/libvirt,rlaager/libvirt,dumbbell/libvirt,elmarco/libvirt,taget/libvirt,jeckersb/libvirt,soulxu/libvirt-xuhj,olafhering/libvirt,novel/fbsd-libvirt,shugaoye/libvirt,trainstack/libvirt,foomango/libvirt,rlaager/libvirt,foomango/libvirt,trainstack/libvirt,novel/fbsd-libvirt,fabianfreyer/libvirt,wiedi/libvirt,emaste/libvirt,rmarwaha/libvirt,fabianfreyer/libvirt,zhlcindy/libvirt-1.1.4-maintain,VenkatDatta/libvirt,agx/libvirt,zippy2/libvirt,cbosdo/libvirt,novel/fbsd-libvirt,jfehlig/libvirt,libvirt/libvirt,leilihh/libvirt,jardasgit/libvirt,foomango/libvirt,fabianfreyer/libvirt,iam-TJ/libvirt,iam-TJ/libvirt,zhlcindy/libvirt-1.1.4-maintain,warewolf/libvirt,danwent/libvirt-ovs,warewolf/libvirt,shugaoye/libvirt,trainstack/libvirt,iam-TJ/libvirt,novel/fbsd-libvirt,eskultety/libvirt,VenkatDatta/libvirt,eskultety/libvirt,novel/fbsd-libvirt,rmarwaha/libvirt,rlaager/libvirt,rmarwaha/libvirt,olafhering/libvirt,trainstack/libvirt,andreabolognani/libvirt,emaste/libvirt,shugaoye/libvirt,usc-isi/libvirt,rbu/libvirt,iam-TJ/libvirt,dumbbell/libvirt,kantai/libvirt-vfork,siboulet/libvirt-openvz,emaste/libvirt,cbosdo/libvirt,datto/libvirt,soulxu/libvirt-xuhj,dumbbell/libvirt,crobinso/libvirt,jeckersb/libvirt,datto/libvirt,zippy2/libvirt,trainstack/libvirt,wiedi/libvirt,novel/fbsd-libvirt,siboulet/libvirt-openvz,nertpinx/libvirt,libvirt/libvirt,danwent/libvirt-ovs,taget/libvirt,wiedi/libvirt,kantai/libvirt-vfork,shugaoye/libvirt,nertpinx/libvirt,kantai/libvirt-vfork,jfehlig/libvirt,trainstack/libvirt,jeckersb/libvirt,dumbbell/libvirt,taget/libvirt,rlaager/libvirt,danwent/libvirt-ovs,dumbbell/libvirt,leilihh/libvirt,foomango/libvirt,siboulet/libvirt-openvz,foomango/libvirt,leilihh/libvirt,rmarwaha/libvirt1,soulxu/libvirt-xuhj,rmarwaha/libvirt1,crobinso/libvirt,libvirt/libvirt,rmarwaha/libvirt1,bjzhang/libvirt,jeckersb/libvirt,leilihh/libvirt,jardasgit/libvirt,jeckersb/libvirt,soulxu/libvirt-xuhj,warewolf/libvirt,nertpinx/libvirt,datto/libvirt,agx/libvirt,kantai/libvirt-vfork,zhlcindy/libvirt-1.1.4-maintain,rmarwaha/libvirt1,olafhering/libvirt,novel/fbsd-libvirt,usc-isi/libvirt,libvirt/libvirt,fabianfreyer/libvirt,jardasgit/libvirt,agx/libvirt,warewolf/libvirt,crobinso/libvirt,bjzhang/libvirt,eskultety/libvirt,jfehlig/libvirt,VenkatDatta/libvirt,agx/libvirt,iam-TJ/libvirt,emaste/libvirt,andreabolognani/libvirt,novel/fbsd-libvirt,elmarco/libvirt,elmarco/libvirt,wiedi/libvirt,andreabolognani/libvirt,nertpinx/libvirt,rbu/libvirt,datto/libvirt,siboulet/libvirt-openvz,olafhering/libvirt,rmarwaha/libvirt1,taget/libvirt,eskultety/libvirt,fabianfreyer/libvirt,jardasgit/libvirt,dumbbell/libvirt,emaste/libvirt,rmarwaha/libvirt,rmarwaha/libvirt,zhlcindy/libvirt-1.1.4-maintain,wiedi/libvirt,taget/libvirt,leilihh/libvirt,zippy2/libvirt,VenkatDatta/libvirt,novel/fbsd-libvirt,warewolf/libvirt,bjzhang/libvirt,bjzhang/libvirt,rlaager/libvirt,trainstack/libvirt,nertpinx/libvirt,cbosdo/libvirt,warewolf/libvirt,cbosdo/libvirt,warewolf/libvirt,agx/libvirt,andreabolognani/libvirt,danwent/libvirt-ovs,jeckersb/libvirt,soulxu/libvirt-xuhj,crobinso/libvirt,zhlcindy/libvirt-1.1.4-maintain,wiedi/libvirt,jeckersb/libvirt,VenkatDatta/libvirt,cbosdo/libvirt,eskultety/libvirt,emaste/libvirt,jardasgit/libvirt,rmarwaha/libvirt1,danwent/libvirt-ovs,usc-isi/libvirt,emaste/libvirt,leilihh/libvirt,usc-isi/libvirt,shugaoye/libvirt,usc-isi/libvirt,siboulet/libvirt-openvz,rbu/libvirt,zippy2/libvirt,rbu/libvirt,jfehlig/libvirt