[libvirt] [PATCH v2 3/6] fdstream: Emit stream abort callback even if poll() doesnt.
Eric Blake
eblake at redhat.com
Wed Dec 14 00:22:48 UTC 2011
On 12/07/2011 11:08 AM, Peter Krempa wrote:
> This patch causes the fdstream driver to call the stream event callback
> if virStreamAbort() is issued on a stream using this driver. This
> prohibited to abort streams from the daemon, as the daemon remote
> handler installs a callback to watch for stream errors as the only mean
> of detecting changes in the stream.
>
> * src/fdstream.c:
> - modify close function to call stream event callback
> ---
> src/fdstream.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++------
> 1 files changed, 50 insertions(+), 6 deletions(-)
>
> + /* aborting the stream, ensure the callback is called if it's
> + * registered for stream error event */
> + if (streamAbort &&
> + fdst->cb &&
> + (fdst->events & (VIR_STREAM_EVENT_READABLE |
> + VIR_STREAM_EVENT_WRITABLE))) {
> + /* don't enter this function accidentaly from the callback again */
s/accidentaly/accidentally/
> + if (fdst->abortCallbackCalled) {
> + virMutexUnlock(&fdst->lock);
> + return 0;
> + }
> +
> + fdst->abortCallbackCalled = true;
> + fdst->abortCallbackDispatching = true;
> + virMutexUnlock(&fdst->lock);
> +
> + /* call failure callback, poll does report nothing on closed fd */
s/does report/reports/
I've read this for sanity, and it seems to make sense, but I'd feel more
comfortable if Dan Berrange gives the final 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/20111213/213aeaf8/attachment-0001.sig>
More information about the libvir-list
mailing list