Re: [PATCH 8/8] test: Fix lock ordering in testDomainRevertToSnapshot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 16.06.2015 19:43, Peter Krempa wrote:
> The test driver lock should not be acquired while a domain object lock
> is held. Tweak the lock ordering to avoid possible deadlock.
> ---
>  src/test/test_driver.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/test/test_driver.c b/src/test/test_driver.c
> index cfec122..9e617a2 100644
> --- a/src/test/test_driver.c
> +++ b/src/test/test_driver.c
> @@ -6603,13 +6603,13 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
>       * and use of FORCE can cause multiple transitions.
>       */
> 
> -    if (!(vm = testDomObjFromSnapshot(snapshot)))
> -        return -1;
> +    testDriverLock(privconn);
> 
> -    if (!(snap = testSnapObjFromSnapshot(vm, snapshot)))
> +    if (!(vm = testDomObjFromDomainLocked(privconn, snapshot->domain)))
>          goto cleanup;
> 
> -    testDriverLock(privconn);
> +    if (!(snap = testSnapObjFromSnapshot(vm, snapshot)))
> +        goto cleanup;
> 
>      if (!vm->persistent &&
>          snap->def->state != VIR_DOMAIN_RUNNING &&
> 

Fortunately, the public API already checked that @snapshot is not NULL
and snapshot->domain is of virDomainClass class.

ACK

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]