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

[Xen-changelog] [xen-unstable] mini-os: Fix frontend shutdown wait loop



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1270624555 -3600
# Node ID 3895f8e0e63310e76a80e88ae31ccee2053ab8f2
# Parent  f46055ab176a33efa1677be500a4578f9ef113e2
mini-os: Fix frontend shutdown wait loop

minios frontends must wait for backends to be shut down and
reinitialized before freeing resources.

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
---
 extras/mini-os/blkfront.c |    2 +-
 extras/mini-os/fbfront.c  |   15 ++++++++++-----
 extras/mini-os/netfront.c |    2 +-
 extras/mini-os/pcifront.c |    2 +-
 4 files changed, 13 insertions(+), 8 deletions(-)

diff -r f46055ab176a -r 3895f8e0e633 extras/mini-os/blkfront.c
--- a/extras/mini-os/blkfront.c Wed Apr 07 08:15:33 2010 +0100
+++ b/extras/mini-os/blkfront.c Wed Apr 07 08:15:55 2010 +0100
@@ -289,7 +289,7 @@ void shutdown_blkfront(struct blkfront_d
         goto close;
     }
     state = xenbus_read_integer(path);
-    if (state < XenbusStateClosed) {
+    while (state < XenbusStateClosed) {
         err = xenbus_wait_for_state_change(path, &state, &dev->events);
         if (err) free(err);
     }
diff -r f46055ab176a -r 3895f8e0e633 extras/mini-os/fbfront.c
--- a/extras/mini-os/fbfront.c  Wed Apr 07 08:15:33 2010 +0100
+++ b/extras/mini-os/fbfront.c  Wed Apr 07 08:15:55 2010 +0100
@@ -262,7 +262,7 @@ void shutdown_kbdfront(struct kbdfront_d
         goto close_kbdfront;
     }
     state = xenbus_read_integer(path);
-    if (state < XenbusStateClosed) {
+    while (state < XenbusStateClosed) {
         err = xenbus_wait_for_state_change(path, &state, &dev->events);
         if (err) free(err);
     }
@@ -272,8 +272,10 @@ void shutdown_kbdfront(struct kbdfront_d
                 XenbusStateInitialising, err);
         goto close_kbdfront;
     }
-    // does not work yet.
-    //xenbus_wait_for_value(path, "2", &dev->events);
+    err = NULL;
+    state = xenbus_read_integer(path);
+    while (err == NULL && (state < XenbusStateInitWait || state >= 
XenbusStateClosed))
+    err = xenbus_wait_for_state_change(path, &state, &dev->events);
 
 close_kbdfront:
     if (err) free(err);
@@ -660,8 +662,11 @@ void shutdown_fbfront(struct fbfront_dev
                 XenbusStateInitialising, err);
         goto close_fbfront;
     }
-    // does not work yet
-    //xenbus_wait_for_value(path, "2", &dev->events);
+
+    err = NULL;
+    state = xenbus_read_integer(path);
+    while (err == NULL && (state < XenbusStateInitWait || state >= 
XenbusStateClosed))
+        err = xenbus_wait_for_state_change(path, &state, &dev->events);
 
 close_fbfront:
     if (err) free(err);
diff -r f46055ab176a -r 3895f8e0e633 extras/mini-os/netfront.c
--- a/extras/mini-os/netfront.c Wed Apr 07 08:15:33 2010 +0100
+++ b/extras/mini-os/netfront.c Wed Apr 07 08:15:55 2010 +0100
@@ -546,7 +546,7 @@ void shutdown_netfront(struct netfront_d
         goto close;
     }
     state = xenbus_read_integer(path);
-    if (state < XenbusStateClosed) {
+    while (state < XenbusStateClosed) {
         err = xenbus_wait_for_state_change(path, &state, &dev->events);
         if (err) free(err);
     }
diff -r f46055ab176a -r 3895f8e0e633 extras/mini-os/pcifront.c
--- a/extras/mini-os/pcifront.c Wed Apr 07 08:15:33 2010 +0100
+++ b/extras/mini-os/pcifront.c Wed Apr 07 08:15:55 2010 +0100
@@ -354,7 +354,7 @@ void shutdown_pcifront(struct pcifront_d
         goto close_pcifront;
     }
     state = xenbus_read_integer(path);
-    if (state < XenbusStateClosed) {
+    while (state < XenbusStateClosed) {
         err = xenbus_wait_for_state_change(path, &state, &dev->events);
         free(err);
     }

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