[libvirt] [PATCH] rpc: Fix client crash on connection close

Eric Blake eblake at redhat.com
Fri Mar 2 23:12:16 UTC 2012


On 03/02/2012 01:49 PM, Jiri Denemark wrote:
> A multi-threaded client with event loop may crash if one of its threads
> closes a connection while event loop is in the middle of sending
> keep-alive message (either request or response). The right place for it
> is inside virNetClientIOEventLoop() between poll() and
> virNetClientLock(). We should only close a connection directly if no-one
> is using it and defer the closing to the last user otherwise. So far we
> only did so if the close was initiated by keep-alive timeout.
> ---
>  src/rpc/virnetclient.c |   18 ++++--------------
>  1 files changed, 4 insertions(+), 14 deletions(-)
> 

> @@ -512,19 +510,11 @@ virNetClientCloseLocked(virNetClientPtr client)
>  
>  void virNetClientClose(virNetClientPtr client)
>  {
> -    if (!client)
> -        return;
> -
> -    virNetClientLock(client);
> -    virNetClientCloseLocked(client);
> -    virNetClientUnlock(client);
> -}
> -
> -static void
> -virNetClientRequestClose(virNetClientPtr client)
> -{
>      VIR_DEBUG("client=%p", client);

The diff that git picked is a bit confusing; but it looks like all you
are doing is stating that virNetClientClose should do the same thing as
virNetClientRequestClose did (which is safer); and now that they do the
same, you don't need two names, so pick the shorter name.

ACK.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

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


More information about the libvir-list mailing list