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

Re: [libvirt] [PATCH] Fix some locking issues



On Thu, Dec 03, 2009 at 12:09:19AM +0100, Matthias Bolte wrote:
> * src/conf/domain_conf.c: don't call virDomainObjUnlock twice
> * src/qemu/qemu_driver.c: relock driver lock if an error occurs in
>   qemuDomainObjBeginJobWithDriver, enter/exit monitor with driver
>   in qemudDomainSave
> ---
>  src/conf/domain_conf.c |    1 -
>  src/qemu/qemu_driver.c |    9 +++++----
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index e9f79b7..21d509d 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -5230,7 +5230,6 @@ virDomainObjIsDuplicate(virDomainObjListPtr doms,
>          }
>  
>          dupVM = 1;
> -        virDomainObjUnlock(vm);
>      } else {
>          /* UUID does not match, but if a name matches, refuse it */
>          vm = virDomainFindByName(doms, def->name);
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index bf4557e..2a63de9 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -353,6 +353,7 @@ static int qemuDomainObjBeginJobWithDriver(struct qemud_driver *driver,
>              else
>                  virReportSystemError(NULL, errno,
>                                       "%s", _("cannot acquire job mutex"));
> +            qemuDriverLock(driver);
>              return -1;
>          }
>      }
> @@ -3612,9 +3613,9 @@ static int qemudDomainSave(virDomainPtr dom,
>      if (header.compressed == QEMUD_SAVE_FORMAT_RAW) {
>          const char *args[] = { "cat", NULL };
>          qemuDomainObjPrivatePtr priv = vm->privateData;
> -        qemuDomainObjEnterMonitor(vm);
> +        qemuDomainObjEnterMonitorWithDriver(driver, vm);
>          rc = qemuMonitorMigrateToCommand(priv->mon, 0, args, path);
> -        qemuDomainObjExitMonitor(vm);
> +        qemuDomainObjExitMonitorWithDriver(driver, vm);
>      } else {
>          const char *prog = qemudSaveCompressionTypeToString(header.compressed);
>          qemuDomainObjPrivatePtr priv = vm->privateData;
> @@ -3623,9 +3624,9 @@ static int qemudDomainSave(virDomainPtr dom,
>              "-c",
>              NULL
>          };
> -        qemuDomainObjEnterMonitor(vm);
> +        qemuDomainObjEnterMonitorWithDriver(driver, vm);
>          rc = qemuMonitorMigrateToCommand(priv->mon, 0, args, path);
> -        qemuDomainObjExitMonitor(vm);
> +        qemuDomainObjExitMonitorWithDriver(driver, vm);
>      }
>  
>      if (rc < 0)

ACK

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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