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-changelog

[Xen-changelog] Do not create blkback vbd kernel thread until fully conn

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Do not create blkback vbd kernel thread until fully connected
From: Xen patchbot -3.0-testing <patchbot-3.0-testing@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 24 Apr 2006 20:50:20 +0000
Delivery-date: Mon, 24 Apr 2006 13:51:22 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID 969b33e87e0a180ca4b2e6513ea1c0d5ccf81c82
# Parent  a8da66acde0c2c06c85476c62e287bd1201a0715
Do not create blkback vbd kernel thread until fully connected
to frontend driver. Otherwise the kernel thread may crash trying
to access the non-existent shared ring.

Replaces xen-3.0-testing cset: 9595:32b22f5286beba94318e60704a8058ac3833d502

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
xen-unstable changeset: 9571:24d25894f071bed67d5547c1790a075271ab1174
xen-unstable date: Thu Apr  6 18:39:00 2006 +0100

diff -r a8da66acde0c -r 969b33e87e0a 
linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c        Sat Apr 22 
10:42:34 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c        Mon Apr 24 
18:06:10 2006 +0100
@@ -221,14 +221,6 @@ int blkif_schedule(void *arg)
 
        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 a8da66acde0c -r 969b33e87e0a 
linux-2.6-xen-sparse/drivers/xen/blkback/common.h
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/common.h Sat Apr 22 10:42:34 
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/common.h Mon Apr 24 18:06:10 
2006 +0100
@@ -135,8 +135,6 @@ int blkif_schedule(void *arg);
 
 void update_blkif_status(blkif_t *blkif); 
 
-int blkif_connected(blkif_t *blkif);
-
 #endif /* __BLKIF__BACKEND__COMMON_H__ */
 
 /*
diff -r a8da66acde0c -r 969b33e87e0a 
linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Sat Apr 22 10:42:34 
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Mon Apr 24 18:06:10 
2006 +0100
@@ -47,18 +47,33 @@ static void backend_changed(struct xenbu
 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)
+
+static void update_blkif_status(blkif_t *blkif)
 { 
-       if(blkif->irq && blkif->vbd.bdev) {
-               blkif->status = CONNECTED; 
-               (void)blkif_be_int(0, blkif, NULL); 
-       }
-       maybe_connect(blkif->be); 
+       int err;
+
+       /* Not ready to connect? */
+       if (!blkif->irq || !blkif->vbd.bdev)
+               return;
+
+       /* Already connected? */
+       if (blkif->be->dev->state == XenbusStateConnected)
+               return;
+
+       /* Attempt to connect: exit if we fail to. */
+       connect(blkif->be);
+       if (blkif->be->dev->state != XenbusStateConnected)
+               return;
+
+       blkif->xenblkd = kthread_run(blkif_schedule, blkif,
+                                    "xvd %d %02x:%02x",
+                                    blkif->domid,
+                                    blkif->be->major, blkif->be->minor);
+       if (IS_ERR(blkif->xenblkd)) {
+               err = PTR_ERR(blkif->xenblkd);
+               blkif->xenblkd = NULL;
+               xenbus_dev_error(blkif->be->dev, err, "start xenblkd");
+       }
 }
 
 
@@ -224,17 +239,6 @@ static void backend_changed(struct xenbu
                        return;
                }
 
-               be->blkif->xenblkd = kthread_run(blkif_schedule, be->blkif,
-                                                "xvd %d %02x:%02x",
-                                                be->blkif->domid,
-                                                be->major, be->minor);
-               if (IS_ERR(be->blkif->xenblkd)) {
-                       err = PTR_ERR(be->blkif->xenblkd);
-                       be->blkif->xenblkd = NULL;
-                       xenbus_dev_error(dev, err, "start xenblkd");
-                       return;
-               }
-
                device_create_file(&dev->dev, &dev_attr_physical_device);
                device_create_file(&dev->dev, &dev_attr_mode);
 

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

<Prev in Thread] Current Thread [Next in Thread>