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-changelog

[Xen-changelog] Read the message type out of the message before sending

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Read the message type out of the message before sending it to xenstored, and
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 15 Apr 2006 21:40:07 +0000
Delivery-date: Sat, 15 Apr 2006 14:41:00 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID 83eb8d81c96f6639d63bb93dabeabb813cbd822c
# Parent  19c55935580fda527f2d865919e51bfd6c2040e4
Read the message type out of the message before sending it to xenstored, and
use that saved value when handling the reply.  Xenstored will leave the
message type intact, _except_ when returning an error, in which case it will
change the type to XS_ERROR.  This meant that we failed to remove a
transaction from our internal list if xenstored returned EAGAIN, as we did not
realise that the message was XS_TRANSACTION_END.  This manifested itself as
the intended behaviour until the connection was closed, at which point all of
those failed transactions would erroneously be aborted.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r 19c55935580f -r 83eb8d81c96f 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c      Wed Apr 12 
17:53:38 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c      Sat Apr 15 
18:25:09 2006
@@ -114,6 +114,7 @@
 {
        struct xenbus_dev_data *u = filp->private_data;
        struct xenbus_dev_transaction *trans = NULL;
+       uint32_t msg_type;
        void *reply;
 
        if ((len + u->len) > sizeof(u->u.buffer))
@@ -126,7 +127,9 @@
        if (u->len < (sizeof(u->u.msg) + u->u.msg.len))
                return len;
 
-       switch (u->u.msg.type) {
+       msg_type = u->u.msg.type;
+
+       switch (msg_type) {
        case XS_TRANSACTION_START:
        case XS_TRANSACTION_END:
        case XS_DIRECTORY:
@@ -138,7 +141,7 @@
        case XS_MKDIR:
        case XS_RM:
        case XS_SET_PERMS:
-               if (u->u.msg.type == XS_TRANSACTION_START) {
+               if (msg_type == XS_TRANSACTION_START) {
                        trans = kmalloc(sizeof(*trans), GFP_KERNEL);
                        if (!trans)
                                return -ENOMEM;
@@ -150,10 +153,10 @@
                        return PTR_ERR(reply);
                }
 
-               if (u->u.msg.type == XS_TRANSACTION_START) {
+               if (msg_type == XS_TRANSACTION_START) {
                        trans->handle = simple_strtoul(reply, NULL, 0);
                        list_add(&trans->list, &u->transactions);
-               } else if (u->u.msg.type == XS_TRANSACTION_END) {
+               } else if (msg_type == XS_TRANSACTION_END) {
                        list_for_each_entry(trans, &u->transactions, list)
                                if (trans->handle == u->u.msg.tx_id)
                                        break;

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

<Prev in Thread] Current Thread [Next in Thread>