Re: [libvirt] [PATCH] Error path mutex unlock in virGetStorageVol.

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

 



On Fri, Aug 07, 2009 at 11:06:15AM +0200, Chris Lalancette wrote:
> Signed-off-by: Chris Lalancette <clalance@xxxxxxxxxx>
> ---
>  src/datatypes.c |    5 +----
>  1 files changed, 1 insertions(+), 4 deletions(-)
> 
> diff --git a/src/datatypes.c b/src/datatypes.c
> index 1889dc3..ac61682 100644
> --- a/src/datatypes.c
> +++ b/src/datatypes.c
> @@ -863,19 +863,16 @@ virGetStorageVol(virConnectPtr conn, const char *pool, const char *name, const c
>      ret = (virStorageVolPtr) virHashLookup(conn->storageVols, key);
>      if (ret == NULL) {
>          if (VIR_ALLOC(ret) < 0) {
> -            virMutexUnlock(&conn->lock);
>              virReportOOMError(conn);
>              goto error;
>          }
>          ret->pool = strdup(pool);
>          if (ret->pool == NULL) {
> -            virMutexUnlock(&conn->lock);
>              virReportOOMError(conn);
>              goto error;
>          }
>          ret->name = strdup(name);
>          if (ret->name == NULL) {
> -            virMutexUnlock(&conn->lock);
>              virReportOOMError(conn);
>              goto error;
>          }
> @@ -885,7 +882,6 @@ virGetStorageVol(virConnectPtr conn, const char *pool, const char *name, const c
>          ret->conn = conn;
>  
>          if (virHashAddEntry(conn->storageVols, key, ret) < 0) {
> -            virMutexUnlock(&conn->lock);
>              virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
>                              "%s", _("failed to add storage vol to connection hash table"));
>              goto error;
> @@ -897,6 +893,7 @@ virGetStorageVol(virConnectPtr conn, const char *pool, const char *name, const c
>      return(ret);
>  
>  error:
> +    virMutexUnlock(&conn->lock);
>      if (ret != NULL) {
>          VIR_FREE(ret->name);
>          VIR_FREE(ret->pool);

NACK, this would be reverting Laines bug fix

commit 647247740fda15a11a9b61b2235fba78a4b81cf2
Author: Laine Stump <laine@xxxxxxxxx>
Date:   Wed Jul 22 19:22:41 2009 +0200

    Release conn lock before reporting errors (end)
    
    * src/datatypes.c: more cleanup, where lock must be released before
      calling error handling which tries to get it.

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 :|

--
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]