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

[Xen-changelog] Fix bug where transaction fires multiple events.



# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID b9903985e9b65969daabec9cada972e3b956da6c
# Parent  052208a34902323ea4ce289d482b7629ca115a59
Fix bug where transaction fires multiple events.
Add general trace() call to help future debugging.
Signed-off-by: Rusty Russel <rusty@xxxxxxxxxxxxxxx>
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>

diff -r 052208a34902 -r b9903985e9b6 tools/xenstore/testsuite/08transaction.sh
--- a/tools/xenstore/testsuite/08transaction.sh Tue Jul 26 15:23:50 2005
+++ b/tools/xenstore/testsuite/08transaction.sh Tue Jul 26 15:24:28 2005
@@ -79,3 +79,15 @@
 2 async commit
 1 waitwatch
 1 ackwatch token' | ./xs_test 2>&1`" = "1:/test/dir/sub:token" ]
+
+# Multiple events from single transaction don't trigger assert
+[ "`echo -e '1 watch /test token
+2 start /test
+2 write /test/1 create contents
+2 write /test/2 create contents
+2 async commit
+1 waitwatch
+1 ackwatch token
+1 waitwatch
+1 ackwatch token' | ./xs_test 2>&1`" = "1:/test/1:token
+1:/test/2:token" ]
diff -r 052208a34902 -r b9903985e9b6 tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c   Tue Jul 26 15:23:50 2005
+++ b/tools/xenstore/xenstored_core.c   Tue Jul 26 15:24:28 2005
@@ -111,6 +111,8 @@
        str = talloc_vasprintf(NULL, fmt, arglist);
        va_end(arglist);
 
+       trace("xenstored corruption: connection id %i: err %s: %s",
+               conn ? (int)conn->id : -1, strerror(saved_errno), str);
        eprintf("xenstored corruption: connection id %i: err %s: %s",
                conn ? (int)conn->id : -1, strerror(saved_errno), str);
 #ifdef TESTING
@@ -228,6 +230,21 @@
        write(tracefd, sockmsg_string(data->hdr.msg.type),
              strlen(sockmsg_string(data->hdr.msg.type)));
        write(tracefd, ")\n", 2);
+}
+
+void trace(const char *fmt, ...)
+{
+       va_list arglist;
+       char *str;
+
+       if (tracefd < 0)
+               return;
+
+       va_start(arglist, fmt);
+       str = talloc_vasprintf(NULL, fmt, arglist);
+       va_end(arglist);
+       write(tracefd, str, strlen(str));
+       talloc_free(str);
 }
 
 static bool write_message(struct connection *conn)
diff -r 052208a34902 -r b9903985e9b6 tools/xenstore/xenstored_core.h
--- a/tools/xenstore/xenstored_core.h   Tue Jul 26 15:23:50 2005
+++ b/tools/xenstore/xenstored_core.h   Tue Jul 26 15:24:28 2005
@@ -170,5 +170,6 @@
 void trace_create(const void *data, const char *type);
 void trace_destroy(const void *data, const char *type);
 void trace_watch_timeout(const struct connection *conn, const char *node, 
const char *token);
+void trace(const char *fmt, ...);
 
 #endif /* _XENSTORED_CORE_H */
diff -r 052208a34902 -r b9903985e9b6 tools/xenstore/xenstored_watch.c
--- a/tools/xenstore/xenstored_watch.c  Tue Jul 26 15:23:50 2005
+++ b/tools/xenstore/xenstored_watch.c  Tue Jul 26 15:24:28 2005
@@ -134,8 +134,6 @@
        if (conn->transaction)
                return false;
 
-       assert(conn->state == OK);
-
        /* Create an event for each watch.  Don't send to self. */
        list_for_each_entry(i, &connections, list) {
                if (i == conn)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.