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

Re: [libvirt] [PATCHv2] event: fix two event-handling bugs



On 01/21/2011 01:06 PM, Eric Blake wrote:
> The first bug has been present since before the time that commit
> f8a519 (Dec 2008) tried to make the dispatch loop re-entrant.

> The second is a regression introduced in commit e6b68d7 (Nov 2010).

I'm splitting this into two commits (to make it easier to backport the
first fix to libvirt 0.8.5 and earlier, since the second bug was
introduced in 0.8.6).

> +++ b/daemon/event.c
> @@ -1,7 +1,7 @@
>  /*
>   * event.c: event loop for monitoring file handles
>   *
> - * Copyright (C) 2007, 2010 Red Hat, Inc.
> + * Copyright (C) 2007, 2010-2011 Red Hat, Inc.
>   * Copyright (C) 2007 Daniel P. Berrange
>   *
>   * This library is free software; you can redistribute it and/or
> @@ -458,14 +458,13 @@ static int virEventDispatchHandles(int nfds, struct pollfd *fds) {
> 
>          if (fds[n].revents) {
>              virEventHandleCallback cb = eventLoop.handles[i].cb;
> +            int watch = eventLoop.handles[i].watch;
>              void *opaque = eventLoop.handles[i].opaque;
>              int hEvents = virPollEventToEventHandleType(fds[n].revents);
>              EVENT_DEBUG("Dispatch n=%d f=%d w=%d e=%d %p", i,
> -                        fds[n].fd, eventLoop.handles[i].watch,
> -                        fds[n].revents, eventLoop.handles[i].opaque);
> +                        fds[n].fd, watch, fds[n].revents, opaque);
>              virMutexUnlock(&eventLoop.lock);
> -            (cb)(eventLoop.handles[i].watch,
> -                 fds[n].fd, hEvents, opaque);
> +            (cb)(watch, fds[n].fd, hEvents, opaque);
>              virMutexLock(&eventLoop.lock);
>          }
>      }

This hunk to commit 1; the rest of the commit to commit 2.

-- 
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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