direct-io.hg

changeset 8442:4c961318d216

Fix uncleaned vif backend devices when frontend does not finish
initialization properly.

Signed-off-by: Murillo F. Bernardes <mfb@br.ibm.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Dec 28 14:55:55 2005 +0100 (2005-12-28)
parents 8b74b9603d5e
children ebe84a7f2a8b
files linux-2.6-xen-sparse/drivers/xen/netback/interface.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c	Wed Dec 28 12:29:15 2005 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c	Wed Dec 28 14:55:55 2005 +0100
     1.3 @@ -247,13 +247,9 @@ static void free_netif_callback(void *ar
     1.4  {
     1.5  	netif_t *netif = (netif_t *)arg;
     1.6  
     1.7 -	/* Already disconnected? */
     1.8 -	if (!netif->irq)
     1.9 -		return;
    1.10 -
    1.11 -	unbind_from_irqhandler(netif->irq, netif);
    1.12 -	netif->irq = 0;
    1.13 -
    1.14 +	if (netif->irq)
    1.15 +		unbind_from_irqhandler(netif->irq, netif);
    1.16 +	
    1.17  	unregister_netdev(netif->dev);
    1.18  
    1.19  	if (netif->tx.sring) {
    1.20 @@ -290,10 +286,10 @@ void netif_creditlimit(netif_t *netif)
    1.21  #endif
    1.22  }
    1.23  
    1.24 -int netif_disconnect(netif_t *netif)
    1.25 +void netif_disconnect(netif_t *netif)
    1.26  {
    1.27 -
    1.28 -	if (netif->status == CONNECTED) {
    1.29 +	switch (netif->status) {
    1.30 +	case CONNECTED:
    1.31  		rtnl_lock();
    1.32  		netif->status = DISCONNECTING;
    1.33  		wmb();
    1.34 @@ -301,10 +297,14 @@ int netif_disconnect(netif_t *netif)
    1.35  			__netif_down(netif);
    1.36  		rtnl_unlock();
    1.37  		netif_put(netif);
    1.38 -		return 0; /* Caller should not send response message. */
    1.39 +		break;
    1.40 +	case DISCONNECTED:
    1.41 +		BUG_ON(atomic_read(&netif->refcnt) != 0);
    1.42 +		free_netif(netif);
    1.43 +		break;
    1.44 +	default:
    1.45 +		BUG();
    1.46  	}
    1.47 -
    1.48 -	return 1;
    1.49  }
    1.50  
    1.51  /*