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

Re: [libvirt] [PATCH 1/2] Remove watches before calling REMOTE_PROC_CLOSE



On Wed, May 12, 2010 at 12:10:18PM +0200, jdenemar redhat com wrote:
> From: Jiri Denemark <jdenemar redhat com>
> 
> First calling REMOTE_PROC_CLOSE and then removing watches might lead to
> a hang as HANGUP event can be triggered before the watches are actually
> removed but after virConnectPtr is already freed. As a result of that
> remoteDomainEventFired() would try to lock uninitialized mutex, which
> would hang for ever.
> ---
>  src/remote/remote_driver.c |   10 +++++-----
>  1 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
> index e4a68ad..990bfce 100644
> --- a/src/remote/remote_driver.c
> +++ b/src/remote/remote_driver.c
> @@ -1418,11 +1418,6 @@ verify_certificate (virConnectPtr conn ATTRIBUTE_UNUSED,
>  static int
>  doRemoteClose (virConnectPtr conn, struct private_data *priv)
>  {
> -    if (call (conn, priv, 0, REMOTE_PROC_CLOSE,
> -              (xdrproc_t) xdr_void, (char *) NULL,
> -              (xdrproc_t) xdr_void, (char *) NULL) == -1)
> -        return -1;
> -
>      if (priv->eventFlushTimer >= 0) {
>          /* Remove timeout */
>          virEventRemoveTimeout(priv->eventFlushTimer);
> @@ -1431,6 +1426,11 @@ doRemoteClose (virConnectPtr conn, struct private_data *priv)
>          priv->watch = -1;
>      }
>  
> +    if (call (conn, priv, 0, REMOTE_PROC_CLOSE,
> +              (xdrproc_t) xdr_void, (char *) NULL,
> +              (xdrproc_t) xdr_void, (char *) NULL) == -1)
> +        return -1;
> +
>      /* Close socket. */
>      if (priv->uses_tls && priv->session) {
>          gnutls_bye (priv->session, GNUTLS_SHUT_RDWR);

ACK, this will prevent us seeing the HANGUP condition.


Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.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]