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

Re: [Xen-devel] Re: [Bug 1612] Can't start VM when vif set and udev vers

To: Jan Beulich <JBeulich@xxxxxxxxxx>
Subject: Re: [Xen-devel] Re: [Bug 1612] Can't start VM when vif set and udev version is greater than 151
From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Date: Tue, 6 Jul 2010 12:46:42 -0400
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>, james.harper@xxxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxx, bastian@xxxxxxxxxxxx
Delivery-date: Tue, 06 Jul 2010 09:48:51 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4C3369970200007800009C71@xxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <bug-1612-1575@xxxxxxxxxxxxxxxxxxxxxxxxxxx/bugzilla/> <201007051720.o65HKsI6030388@xxxxxxxxxxxxxxxxxxxxxx> <20100706151023.GA25263@xxxxxxxxxxxxxxxxxxx> <4C3369970200007800009C71@xxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.20 (2009-12-10)
> > 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.

Ah nice.. 

I get this:
patch -p1 --dry-run < ~/p.patch 
patching file drivers/xen/netback/xenbus.c
Hunk #1 succeeded at 19 with fuzz 1.
Hunk #2 FAILED at 29.
Hunk #3 FAILED at 40.
patch: **** malformed patch at line 120: nv *env)

If it would not be too much trouble, can you attach it as an attachment?

> 
> 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);
>  }
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel

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