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

[Xen-changelog] Fix case where watch callback unregisters itself: do not try to ack it



# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID 5f04469075016429efbba7fef18adcc6682885a4
# Parent  26e4e952c385894cec4a028eeceb102e348def27
Fix case where watch callback unregisters itself: do not try to ack it
Signed-off-by: Rusty Russel <rusty@xxxxxxxxxxxxxxx>
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>

diff -r 26e4e952c385 -r 5f0446907501 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c       Tue Jul 26 
17:25:57 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c       Tue Jul 26 
17:27:26 2005
@@ -485,6 +485,8 @@
        return err;
 }
 
+static struct xenbus_watch *watch_callback;
+
 void unregister_xenbus_watch(struct xenbus_watch *watch)
 {
        char token[sizeof(watch) * 2 + 1];
@@ -495,6 +497,10 @@
 
        err = xs_unwatch(watch->node, token);
        list_del(&watch->list);
+
+       /* Make sure watch thread knows we unwatched, so don't ack. */
+       if (watch_callback == watch)
+               watch_callback = NULL;
 
        if (err)
                printk(KERN_WARNING "XENBUS Failed to release watch %s: %i\n",
@@ -523,13 +529,16 @@
 
                        w = find_watch(token);
                        BUG_ON(!w);
+                       watch_callback = w;
                        w->callback(w, node);
-                       /* FIXME: Only ack if it wasn't deleted. */
-                       err = xs_acknowledge_watch(token);
-                       if (err)
-                               printk(KERN_WARNING
-                                      "XENBUS acknowledge %s failed %i\n",
-                                      node, err);
+
+                       if (watch_callback) {
+                               err = xs_acknowledge_watch(token);
+                               if (err)
+                                       printk(KERN_WARNING
+                                              "XENBUS ack %s fail %i\n",
+                                              node, err);
+                       }
                        kfree(node);
                } else
                        printk(KERN_WARNING "XENBUS xs_read_watch: %li\n",

_______________________________________________
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®.