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,MINI-OS] Fix xenbus_unwatch_path calls

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH,MINI-OS] Fix xenbus_unwatch_path calls
From: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
Date: Mon, 23 Nov 2009 01:11:56 +0100
Delivery-date: Sun, 22 Nov 2009 16:12:23 -0800
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Mail-followup-to: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.12-2006-07-14
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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH,MINI-OS] Fix xenbus_unwatch_path calls, Samuel Thibault <=