From: Murillo Bernardes Subject: [PATCH] Fix uncleaned vif backend devices when frontend does not finish initialization properly Date: Mon, 26 Dec 2005 22:24:11 -0200 Message-ID: <200512262224.11818.mfb@br.ibm.com> Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_rmIsDS3VJdqUpgc" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --Boundary-00=_rmIsDS3VJdqUpgc Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Today if frontend device does not finish initialization the backend vif still in dom0 forever. The problems are: - netif_disconnect only clean up devices with connected status. When a device has a problem it will not have that status and will not be cleaned up. - free_netif_callback must be able to unregister devices not completely initialized. Today's code test if it has an irq assigned, if not it just return. Before a complete initialization netif does not have an irq number. Both situations occur today when trying to create more than 3 vif in a single domU. This patch fix uncleaned vif backend devices when frontend does not finish initialization properly. Comments welcome. Signed-off-by: Murillo F. Bernardes -- Murillo Fernandes Bernardes IBM Linux Technology Center --Boundary-00=_rmIsDS3VJdqUpgc Content-Type: text/x-diff; charset="iso-8859-1"; name="clean_backend_vifs-netback.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="clean_backend_vifs-netback.patch" # HG changeset patch # User root@localhost.localdomain # Node ID c066abe3893a03e4b3697ac6c661271a5e9afae7 # Parent 829517be689f95d3d935ab1af17d0c31ee4950fc Today if frontend device does not finish initialization the backend vif still in dom0 forever. The problems are: - netif_disconnect only clean up devices with connected status. When a device has a problem it will not have that status and will not be cleaned up. - free_netif_callback must be able to unregister devices not completely initialized. Today's code test if it has an irq assigned, if not it just return. Before a complete initialization netif does not have an irq number. Both situations occur today when trying to create more than 3 vif in a single domU. This patch fix uncleaned vif backend devices when frontend does not finish initialization properly. Signed-off-by: Murillo F. Bernardes diff -r 829517be689f -r c066abe3893a linux-2.6-xen-sparse/drivers/xen/netback/interface.c --- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c Fri Dec 23 15:42:46 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c Mon Dec 26 22:13:53 2005 @@ -248,12 +248,11 @@ netif_t *netif = (netif_t *)arg; /* Already disconnected? */ - if (!netif->irq) - return; - - unbind_from_irqhandler(netif->irq, netif); - netif->irq = 0; - + if (netif->irq) { + unbind_from_irqhandler(netif->irq, netif); + netif->irq = 0; + } + unregister_netdev(netif->dev); if (netif->tx.sring) { @@ -303,6 +302,10 @@ netif_put(netif); return 0; /* Caller should not send response message. */ } + else { + free_netif(netif); + return 0; + } return 1; } --Boundary-00=_rmIsDS3VJdqUpgc Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --Boundary-00=_rmIsDS3VJdqUpgc--