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

[Xen-changelog] Fix another blkback kernel thread I introduced. :-( The kernel thread



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 32b22f5286beba94318e60704a8058ac3833d502
# Parent  251b7d5164bd043946f69c711757209ae378720c
Fix another blkback kernel thread I introduced. :-( The kernel thread
is created before we are fully connected to the front end, so before
entering the main loop we must make sure that the shared ring is
mapped, otherwise we can fault.

This patch is an essential companion to the other two blkback
patches I committed earlier today. Hopefully this ends the saga.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r 251b7d5164bd -r 32b22f5286be 
linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c        Thu Apr  6 
16:51:14 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c        Thu Apr  6 
17:34:32 2006
@@ -221,6 +221,14 @@
 
        if (debug_lvl)
                printk(KERN_DEBUG "%s: started\n", current->comm);
+
+       /*
+        * This thread may start before we are connected to the frontend
+        * driver. In that case we must wait to be fully connected.
+        */
+       wait_event_interruptible(
+               blkif->wq,
+               blkif_connected(blkif) || kthread_should_stop());
 
        while (!kthread_should_stop()) {
                wait_event_interruptible(
diff -r 251b7d5164bd -r 32b22f5286be 
linux-2.6-xen-sparse/drivers/xen/blkback/common.h
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/common.h Thu Apr  6 16:51:14 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/common.h Thu Apr  6 17:34:32 2006
@@ -135,6 +135,8 @@
 
 void update_blkif_status(blkif_t *blkif); 
 
+int blkif_connected(blkif_t *blkif);
+
 #endif /* __BLKIF__BACKEND__COMMON_H__ */
 
 /*
diff -r 251b7d5164bd -r 32b22f5286be 
linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Thu Apr  6 16:51:14 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Thu Apr  6 17:34:32 2006
@@ -47,6 +47,10 @@
 static void backend_changed(struct xenbus_watch *, const char **,
                            unsigned int);
 
+int blkif_connected(blkif_t *blkif)
+{
+       return (blkif->be->dev->state == XenbusStateConnected);
+}
 
 void update_blkif_status(blkif_t *blkif)
 { 

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