WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 3/11] Test and fix acknowedge_watch from returning EI

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 3/11] Test and fix acknowedge_watch from returning EINVAL.
From: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
Date: Thu, 04 Aug 2005 22:31:22 +1000
Delivery-date: Thu, 04 Aug 2005 12:30:42 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Rusty Russell <rusty@xxxxxxxxxxxxxxx>
# Node ID 70ea61257cebc00212defe1dbed6de26c2edcf30
# Parent  e158ae50d2613b3e01d41c395b8dbc34c9766f73
Test and fix acknowedge_watch from returning EINVAL.
Also ensure that daemon re-xmits event if they ack wrong thing (otherwise 
confused clients get stuck, as we will send no more data while awaiting ack).

Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>

diff -r e158ae50d261 -r 70ea61257ceb tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c   Thu Aug  4 09:18:42 2005
+++ b/tools/xenstore/xenstored_core.c   Thu Aug  4 09:28:24 2005
@@ -1162,7 +1162,7 @@
        /* We might get a command while waiting for an ack: this means
         * the other end discarded it: we will re-transmit. */
        if (type != XS_WATCH_ACK)
-               conn->waiting_for_ack = false;
+               conn->waiting_for_ack = NULL;
 
        /* Careful: process_message may free connection.  We detach
         * "in" beforehand and allocate the new buffer to avoid
diff -r e158ae50d261 -r 70ea61257ceb tools/xenstore/xenstored_core.h
--- a/tools/xenstore/xenstored_core.h   Thu Aug  4 09:18:42 2005
+++ b/tools/xenstore/xenstored_core.h   Thu Aug  4 09:28:24 2005
@@ -64,7 +64,7 @@
        bool can_write;
 
        /* Are we waiting for a watch event ack? */
-       bool waiting_for_ack;
+       struct watch *waiting_for_ack;
 
        /* Buffered incoming data. */
        struct buffered_data *in;
diff -r e158ae50d261 -r 70ea61257ceb tools/xenstore/xenstored_watch.c
--- a/tools/xenstore/xenstored_watch.c  Thu Aug  4 09:18:42 2005
+++ b/tools/xenstore/xenstored_watch.c  Thu Aug  4 09:28:24 2005
@@ -102,7 +102,7 @@
        if (conn->waiting_reply) {
                conn->out = conn->waiting_reply;
                conn->waiting_reply = NULL;
-               conn->waiting_for_ack = false;
+               conn->waiting_for_ack = NULL;
                return;
        }
 
@@ -115,7 +115,7 @@
                return;
 
        /* If we decide to cancel, we will reset this. */
-       conn->waiting_for_ack = true;
+       conn->waiting_for_ack = event->watches[0];
 
        /* If we deleted /foo and they're watching /foo/bar, that's what we
         * tell them has changed. */
@@ -347,12 +347,17 @@
        if (!conn->waiting_for_ack)
                return send_error(conn, ENOENT);
 
-       event = get_first_event(conn);
-       if (!streq(event->watches[0]->token, token))
+       event = list_top(&conn->waiting_for_ack->events,
+                        struct watch_event, list);
+       assert(event->watches[0] == conn->waiting_for_ack);
+       if (!streq(conn->waiting_for_ack->token, token)) {
+               /* They're confused: this will cause us to send event again */
+               conn->waiting_for_ack = NULL;
                return send_error(conn, EINVAL);
+       }
 
        move_event_onwards(event);
-       conn->waiting_for_ack = false;
+       conn->waiting_for_ack = NULL;
        return send_ack(conn, XS_WATCH_ACK);
 }
 


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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 3/11] Test and fix acknowedge_watch from returning EINVAL., Rusty Russell <=