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

[Xen-devel] [PATCH,MINI-OS] Fix xenbus_unwatch_path calls



In a lot of places in MiniOS frontends, xenbus_watch_path_token is used
instead of xenbus_watch_path to get more precise wake ups.  To free
those, xenbus_unwatch_path_token has to be used instead of
xenbus_unwatch_path, else the unwatch operation will fail.
This fixes spurious watch events left by pv-grub.

Signed-Off-By: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>

diff -r bec27eb6f72c extras/mini-os/blkfront.c
--- a/extras/mini-os/blkfront.c Sat Nov 14 10:32:59 2009 +0000
+++ b/extras/mini-os/blkfront.c Mon Nov 23 01:05:15 2009 +0100
@@ -208,7 +208,7 @@
             msg = xenbus_wait_for_state_change(path, &state, &dev->events);
         if (msg != NULL || state != XenbusStateConnected) {
             printk("backend not available, state=%d\n", state);
-            xenbus_unwatch_path(XBT_NIL, path);
+            xenbus_unwatch_path_token(XBT_NIL, path, path);
             goto error;
         }
 
@@ -286,7 +286,7 @@
         err = xenbus_wait_for_state_change(path, &state, &dev->events);
 
 close:
-    xenbus_unwatch_path(XBT_NIL, path);
+    xenbus_unwatch_path_token(XBT_NIL, path, path);
 
     snprintf(path, sizeof(path), "%s/ring-ref", nodename);
     xenbus_rm(XBT_NIL, path);
diff -r bec27eb6f72c extras/mini-os/console/xencons_ring.c
--- a/extras/mini-os/console/xencons_ring.c     Sat Nov 14 10:32:59 2009 +0000
+++ b/extras/mini-os/console/xencons_ring.c     Mon Nov 23 01:05:15 2009 +0100
@@ -312,7 +312,7 @@
             msg = xenbus_wait_for_state_change(path, &state, &dev->events);
         if (msg != NULL || state != XenbusStateConnected) {
             printk("backend not available, state=%d\n", state);
-            xenbus_unwatch_path(XBT_NIL, path);
+            xenbus_unwatch_path_token(XBT_NIL, path, path);
             goto error;
         }
     }
diff -r bec27eb6f72c extras/mini-os/fbfront.c
--- a/extras/mini-os/fbfront.c  Sat Nov 14 10:32:59 2009 +0000
+++ b/extras/mini-os/fbfront.c  Mon Nov 23 01:05:15 2009 +0100
@@ -165,7 +166,7 @@
             err = xenbus_wait_for_state_change(path, &state, &dev->events);
         if (state != XenbusStateConnected) {
             printk("backend not available, state=%d\n", state);
-            xenbus_unwatch_path(XBT_NIL, path);
+            xenbus_unwatch_path_token(XBT_NIL, path, path);
             goto error;
         }
 
@@ -175,7 +176,7 @@
         if((err = xenbus_switch_state(XBT_NIL, frontpath, 
XenbusStateConnected))
             != NULL) {
             printk("error switching state: %s\n", err);
-            xenbus_unwatch_path(XBT_NIL, path);
+            xenbus_unwatch_path_token(XBT_NIL, path, path);
             goto error;
         }
     }
@@ -265,7 +266,7 @@
     //xenbus_wait_for_value(path, "2", &dev->events);
 
 close_kbdfront:
-    xenbus_unwatch_path(XBT_NIL, path);
+    xenbus_unwatch_path_token(XBT_NIL, path, path);
 
     snprintf(path, sizeof(path), "%s/page-ref", nodename);
     xenbus_rm(XBT_NIL, path);
@@ -513,7 +515,7 @@
             err = xenbus_wait_for_state_change(path, &state, &dev->events);
         if (state != XenbusStateConnected) {
             printk("backend not available, state=%d\n", state);
-            xenbus_unwatch_path(XBT_NIL, path);
+            xenbus_unwatch_path_token(XBT_NIL, path, path);
             goto error;
         }
 
@@ -526,7 +528,7 @@
         if ((err = xenbus_switch_state(XBT_NIL, frontpath, 
XenbusStateConnected))
             != NULL) {
             printk("error switching state: %s\n", err);
-            xenbus_unwatch_path(XBT_NIL, path);
+            xenbus_unwatch_path_token(XBT_NIL, path, path);
             goto error;
         }
     }
@@ -644,7 +646,7 @@
     //xenbus_wait_for_value(path, "2", &dev->events);
 
 close_fbfront:
-    xenbus_unwatch_path(XBT_NIL, path);
+    xenbus_unwatch_path_token(XBT_NIL, path, path);
 
     snprintf(path, sizeof(path), "%s/page-ref", nodename);
     xenbus_rm(XBT_NIL, path);
diff -r bec27eb6f72c extras/mini-os/fs-front.c
--- a/extras/mini-os/fs-front.c Sat Nov 14 10:32:59 2009 +0000
+++ b/extras/mini-os/fs-front.c Mon Nov 23 01:05:15 2009 +0100
@@ -1190,7 +1190,7 @@
     /* The token will not be unique if multiple imports are inited */
     xenbus_watch_path_token(XBT_NIL, r_nodename, r_nodename, &events);
     xenbus_wait_for_value(r_nodename, STATE_READY, &events);
-    xenbus_unwatch_path(XBT_NIL, r_nodename);
+    xenbus_unwatch_path_token(XBT_NIL, r_nodename, r_nodename);
     printk("Backend ready.\n");
    
     //create_thread("fs-tester", test_fs_import, import); 
diff -r bec27eb6f72c extras/mini-os/netfront.c
--- a/extras/mini-os/netfront.c Sat Nov 14 10:32:59 2009 +0000
+++ b/extras/mini-os/netfront.c Mon Nov 23 01:05:15 2009 +0100
@@ -452,7 +452,7 @@
             err = xenbus_wait_for_state_change(path, &state, &dev->events);
         if (state != XenbusStateConnected) {
             printk("backend not avalable, state=%d\n", state);
-            xenbus_unwatch_path(XBT_NIL, path);
+            xenbus_unwatch_path_token(XBT_NIL, path, path);
             goto error;
         }
 
@@ -542,7 +542,7 @@
         err = xenbus_wait_for_state_change(path, &state, &dev->events);
 
 close:
-    xenbus_unwatch_path(XBT_NIL, path);
+    xenbus_unwatch_path_token(XBT_NIL, path, path);
 
     snprintf(path, sizeof(path), "%s/tx-ring-ref", nodename);
     xenbus_rm(XBT_NIL, path);
diff -r bec27eb6f72c extras/mini-os/pcifront.c
--- a/extras/mini-os/pcifront.c Sat Nov 14 10:32:59 2009 +0000
+++ b/extras/mini-os/pcifront.c Mon Nov 23 01:05:15 2009 +0100
@@ -246,7 +246,7 @@
             err = xenbus_wait_for_state_change(path, &state, &dev->events);
         if (state != XenbusStateConnected) {
             printk("backend not avalable, state=%d\n", state);
-            xenbus_unwatch_path(XBT_NIL, path);
+            xenbus_unwatch_path_token(XBT_NIL, path, path);
             goto error;
         }
 
@@ -254,7 +254,7 @@
         if ((err = xenbus_switch_state(XBT_NIL, frontpath, 
XenbusStateConnected))
             != NULL) {
             printk("error switching state %s\n", err);
-            xenbus_unwatch_path(XBT_NIL, path);
+            xenbus_unwatch_path_token(XBT_NIL, path, path);
             goto error;
         }
     }
@@ -353,7 +353,7 @@
         err = xenbus_wait_for_state_change(path, &state, &dev->events);
 
 close_pcifront:
-    xenbus_unwatch_path(XBT_NIL, path);
+    xenbus_unwatch_path_token(XBT_NIL, path, path);
 
     snprintf(path, sizeof(path), "%s/info-ref", nodename);
     xenbus_rm(XBT_NIL, path);

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


 


Rackspace

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