[libvirt] [PATCH] rpc: Really send non-blocking calls while waiting for another call

Jiri Denemark jdenemar at redhat.com
Tue Nov 29 07:49:55 UTC 2011


On Mon, Nov 28, 2011 at 17:53:36 +0000, Daniel P. Berrange wrote:
> On Mon, Nov 28, 2011 at 06:23:14PM +0100, Jiri Denemark wrote:
> > When another thread was dispatching while we wanted to send a
> > non-blocking call, we correctly queued the call and woke up the thread
> > but the thread just threw the call away since it forgot to recheck if
> > its socket was writable.
> > ---
> >  src/rpc/virnetclient.c |   10 ++++++++++
> >  1 files changed, 10 insertions(+), 0 deletions(-)
> > 
> > diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
> > index aad7f5d..a738129 100644
> > --- a/src/rpc/virnetclient.c
> > +++ b/src/rpc/virnetclient.c
> > @@ -1381,6 +1381,16 @@ static int virNetClientIOEventLoop(virNetClientPtr client,
> >                                       _("read on wakeup fd failed"));
> >                  goto error;
> >              }
> > +
> > +            /* If we were woken up because a new non-blocking call was queued,
> > +             * we need to re-poll to check if we can send it.
> > +             */
> > +            if (virNetClientCallMatchPredicate(client->waitDispatch,
> > +                                               virNetClientIOEventLoopWantNonBlock,
> > +                                               NULL)) {
> > +                VIR_DEBUG("New non-blocking call arrived; repolling");
> > +                continue;
> > +            }
> >          }
> >  
> >          if (ret < 0) {
> 
> ACK

Pushed, thanks.

Jirka




More information about the libvir-list mailing list