[libvirt] [PATCH 2/3] qemu: Don't access vm->priv on unlocked domain

Ján Tomko jtomko at redhat.com
Wed Nov 6 16:07:03 UTC 2013


On 11/06/2013 02:06 PM, Michal Privoznik wrote:
> Since 86d90b3a (yes, my patch; again) we are supporting NBD storage
> migration. However, on error recovery path we got the steps reversed.
> The correct order is: return NBD port to the virPortAllocator and then
> either unlock the vm or remove it from the driver. Not vice versa.
> 
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/qemu/qemu_migration.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index 4f35a7a..13d0808 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -2450,13 +2450,14 @@ cleanup:
>      VIR_FORCE_CLOSE(dataFD[0]);
>      VIR_FORCE_CLOSE(dataFD[1]);
>      if (vm) {
> -        if (ret >= 0 || vm->persistent)
> -            virObjectUnlock(vm);
> -        else
> -            qemuDomainRemoveInactive(driver, vm);
>          if (ret < 0) {
>              virPortAllocatorRelease(driver->remotePorts, priv->nbdPort);
>              priv->nbdPort = 0;
> +        } else {
> +            if (vm->persistent)
> +                virObjectUnlock(vm);
> +            else
> +                qemuDomainRemoveInactive(driver, vm);
>          }
>      }
>      if (event)
> 

On second thought, this doesn't unlock the VM if (ret < 0) && (vm->persistent).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20131106/93a4aa36/attachment-0001.sig>


More information about the libvir-list mailing list