Rusty Russell
2005-Aug-04 12:31 UTC
[Xen-devel] [PATCH 5/11] Fix bug where watch messages didn''t go out to domains, causing them to get stuck.
# HG changeset patch # User Rusty Russell <rusty@rustcorp.com.au> # Node ID ba5d5bd28edf8bce89bdf9fc64047ee4f1dceded # Parent d4ab9ac93104a13a09ebfaa2384281c4e3392e3f Fix bug where watch messages didn''t go out to domains, causing them to get stuck. Also, change xs_test to more closely reflect xenbus behaviour to exhibit bug. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> diff -r d4ab9ac93104 -r ba5d5bd28edf tools/xenstore/xenstored_core.c --- a/tools/xenstore/xenstored_core.c Thu Aug 4 10:34:26 2005 +++ b/tools/xenstore/xenstored_core.c Thu Aug 4 10:43:03 2005 @@ -270,7 +270,7 @@ out->used = 0; /* Second write might block if non-zero. */ - if (out->hdr.msg.len) + if (out->hdr.msg.len && !conn->domain) return true; } diff -r d4ab9ac93104 -r ba5d5bd28edf tools/xenstore/xs_test.c --- a/tools/xenstore/xs_test.c Thu Aug 4 10:34:26 2005 +++ b/tools/xenstore/xs_test.c Thu Aug 4 10:43:03 2005 @@ -80,6 +80,14 @@ return buf + h->read; } +static int output_avail(struct ringbuf_head *out) +{ + unsigned int avail; + + get_output_chunk(out, out->buf, &avail); + return avail != 0; +} + static void update_output_chunk(struct ringbuf_head *h, uint32_t len) { h->write += len; @@ -99,10 +107,12 @@ void *data, unsigned int len) { unsigned int avail; + int was_full; if (!check_buffer(in)) barf("Corrupt buffer"); + was_full = !output_avail(in); while (len) { const void *src = get_input_chunk(in, in->buf, &avail); if (avail > len) @@ -114,7 +124,8 @@ } /* Tell other end we read something. */ - kill(daemon_pid, SIGUSR2); + if (was_full) + kill(daemon_pid, SIGUSR2); return true; } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel