xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@novell.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
	james.harper@bendigoit.com.au, xen-devel@lists.xensource.com,
	bastian@waldi.eu.org
Subject: Re: [Bug 1612] Can't start VM when vif set and udev version is greater than 151
Date: Tue, 06 Jul 2010 16:36:23 +0100	[thread overview]
Message-ID: <4C3369970200007800009C71@vpn.id2.novell.com> (raw)
In-Reply-To: <20100706151023.GA25263@phenom.dumpdata.com>

>>> On 06.07.10 at 17:10, Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:
>> ------- Comment #28 from silversens@gmail.com  2010-07-05 10:20 -------
>> (In reply to comment #26)
>> > (In reply to comment #25)
>> > > Great, 
>> > > 
>> > > Will it be applyed in every xen kernel, or only from 2.6.32 ?
>> > > 
>> > The policy is to stick bug-fixes in xen/next which are then pulled in
>> > xen/stable-2.6.32.x. But this being such a serious issue, and a small patch
>> > that I think Jeremy would stick it in 2.6.31 once it has passed review.
>> > 
>> 
>> Its been a few weeks now, do you know when this patch will be included in
>> jeremy's repository ? If not can you paste a link here to this patch ?
>> 
> 
> Soooo.. the last I remember it was that the patch for this was not
> appropiate. But I don't remember the details - is there a forthcoming
> patch that can fix the outstanding issue?
> 
> Or is the patch ready and we forgot about it?

For reference, below is the diff for what we're now using.

Jan

--- a/drivers/xen/netback/xenbus.c
+++ b/drivers/xen/netback/xenbus.c
@@ -19,6 +19,7 @@
 
 #include <stdarg.h>
 #include <linux/module.h>
+#include <linux/rwsem.h>
 #include <xen/xenbus.h>
 #include "common.h"
 
@@ -28,6 +29,7 @@
     printk("netback/xenbus (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args)
 #endif
 
+static DECLARE_RWSEM(teardown_sem);
 
 static int connect_rings(struct backend_info *);
 static void connect(struct backend_info *);
@@ -39,13 +41,18 @@ static int netback_remove(struct xenbus_
 
 	netback_remove_accelerators(be, dev);
 
-	if (be->netif) {
+	if (be->netif)
 		kobject_uevent(&dev->dev.kobj, KOBJ_OFFLINE);
+
+	down_write(&teardown_sem);
+	if (be->netif) {
 		netif_disconnect(be->netif);
 		be->netif = NULL;
 	}
-	kfree(be);
 	dev_set_drvdata(&dev->dev, NULL);
+	up_write(&teardown_sem);
+	kfree(be);
+
 	return 0;
 }
 
@@ -151,8 +158,7 @@ fail:
  */
 static int netback_uevent(struct xenbus_device *xdev, struct kobj_uevent_env *env)
 {
-	struct backend_info *be = dev_get_drvdata(&xdev->dev);
-	netif_t *netif = be->netif;
+	struct backend_info *be;
 	char *val;
 
 	DPRINTK("netback_uevent");
@@ -163,12 +169,15 @@ static int netback_uevent(struct xenbus_
 		xenbus_dev_fatal(xdev, err, "reading script");
 		return err;
 	}
-	else {
-		add_uevent_var(env, "script=%s", val);
-		kfree(val);
-	}
 
-	add_uevent_var(env, "vif=%s", netif->dev->name);
+	add_uevent_var(env, "script=%s", val);
+	kfree(val);
+
+	down_read(&teardown_sem);
+	be = dev_get_drvdata(&xdev->dev);
+	if (be && be->netif)
+		add_uevent_var(env, "vif=%s", be->netif->dev->name);
+	up_read(&teardown_sem);
 
 	return 0;
 }
@@ -179,6 +188,7 @@ static void backend_create_netif(struct 
 	int err;
 	long handle;
 	struct xenbus_device *dev = be->dev;
+	netif_t *netif;
 
 	if (be->netif != NULL)
 		return;
@@ -189,13 +199,13 @@ static void backend_create_netif(struct 
 		return;
 	}
 
-	be->netif = netif_alloc(&dev->dev, dev->otherend_id, handle);
-	if (IS_ERR(be->netif)) {
-		err = PTR_ERR(be->netif);
-		be->netif = NULL;
+	netif = netif_alloc(&dev->dev, dev->otherend_id, handle);
+	if (IS_ERR(netif)) {
+		err = PTR_ERR(netif);
 		xenbus_dev_fatal(dev, err, "creating interface");
 		return;
 	}
+	be->netif = netif;
 
 	kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE);
 }

  reply	other threads:[~2010-07-06 15:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-1612-1575@http.bugzilla.xensource.com/bugzilla/>
     [not found] ` <201007051720.o65HKsI6030388@bugzilla.xensource.com>
2010-07-06 15:10   ` [Bug 1612] Can't start VM when vif set and udev version is greater than 151 Konrad Rzeszutek Wilk
2010-07-06 15:36     ` Jan Beulich [this message]
2010-07-06 16:46       ` Konrad Rzeszutek Wilk
2010-07-07  7:30         ` Jan Beulich
2010-07-07 14:48           ` Konrad Rzeszutek Wilk
2010-07-07 15:26             ` Jeremy Fitzhardinge
2010-07-07 17:18               ` Konrad Rzeszutek Wilk
2010-07-07 17:34                 ` Jeremy Fitzhardinge
2010-07-07 17:57                 ` Set up bridging under Xen 4.1-unstable ( 2.6.31.15 pvops) on top of Ubuntu 10.04 Server Boris Derzhavets
2010-07-07 18:21                   ` Sander Eikelenboom
2010-07-07 19:11                     ` Boris Derzhavets
2010-07-08  9:11                       ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C3369970200007800009C71@vpn.id2.novell.com \
    --to=jbeulich@novell.com \
    --cc=bastian@waldi.eu.org \
    --cc=james.harper@bendigoit.com.au \
    --cc=jeremy@goop.org \
    --cc=konrad.wilk@oracle.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).