From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" 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 Message-ID: <4C3369970200007800009C71@vpn.id2.novell.com> References: <201007051720.o65HKsI6030388@bugzilla.xensource.com> <20100706151023.GA25263@phenom.dumpdata.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20100706151023.GA25263@phenom.dumpdata.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Konrad Rzeszutek Wilk Cc: Jeremy Fitzhardinge , james.harper@bendigoit.com.au, xen-devel@lists.xensource.com, bastian@waldi.eu.org List-Id: xen-devel@lists.xenproject.org >>> On 06.07.10 at 17:10, Konrad Rzeszutek Wilk = wrote: >> ------- Comment #28 from silversens@gmail.com 2010-07-05 10:20 ------- >> (In reply to comment #26) >> > (In reply to comment #25) >> > > Great,=20 >> > >=20 >> > > Will it be applyed in every xen kernel, or only from 2.6.32 ? >> > >=20 >> > 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. >> >=20 >>=20 >> 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 ? >>=20 >=20 > 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? >=20 > 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 @@ =20 #include #include +#include #include #include "common.h" =20 @@ -28,6 +29,7 @@ printk("netback/xenbus (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, = ##args) #endif =20 +static DECLARE_RWSEM(teardown_sem); =20 static int connect_rings(struct backend_info *); static void connect(struct backend_info *); @@ -39,13 +41,18 @@ static int netback_remove(struct xenbus_ =20 netback_remove_accelerators(be, dev); =20 - 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 =3D NULL; } - kfree(be); dev_set_drvdata(&dev->dev, NULL); + up_write(&teardown_sem); + kfree(be); + return 0; } =20 @@ -151,8 +158,7 @@ fail: */ static int netback_uevent(struct xenbus_device *xdev, struct kobj_uevent_e= nv *env) { - struct backend_info *be =3D dev_get_drvdata(&xdev->dev); - netif_t *netif =3D be->netif; + struct backend_info *be; char *val; =20 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=3D%s", val); - kfree(val); - } =20 - add_uevent_var(env, "vif=3D%s", netif->dev->name); + add_uevent_var(env, "script=3D%s", val); + kfree(val); + + down_read(&teardown_sem); + be =3D dev_get_drvdata(&xdev->dev); + if (be && be->netif) + add_uevent_var(env, "vif=3D%s", be->netif->dev->name); + up_read(&teardown_sem); =20 return 0; } @@ -179,6 +188,7 @@ static void backend_create_netif(struct=20 int err; long handle; struct xenbus_device *dev =3D be->dev; + netif_t *netif; =20 if (be->netif !=3D NULL) return; @@ -189,13 +199,13 @@ static void backend_create_netif(struct=20 return; } =20 - be->netif =3D netif_alloc(&dev->dev, dev->otherend_id, handle); - if (IS_ERR(be->netif)) { - err =3D PTR_ERR(be->netif); - be->netif =3D NULL; + netif =3D netif_alloc(&dev->dev, dev->otherend_id, handle); + if (IS_ERR(netif)) { + err =3D PTR_ERR(netif); xenbus_dev_fatal(dev, err, "creating interface"); return; } + be->netif =3D netif; =20 kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE); }