xen-netback: enable user to unload netback module

This patch enables user to unload netback module, which is useful when user
wants to upgrade to a newer netback module without rebooting the host.

Netfront cannot handle netback removal event. As we cannot fix all possible
frontends we add module get / put along with vif get / put to avoid
mis-unloading of netback. To unload netback module, user needs to shutdown all
VMs or migrate them to another host or unplug all vifs before hand.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>¬
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Wei Liu 2013-05-16 23:26:11 +00:00 committed by David S. Miller
parent f1db320ec5
commit b103f358d9
4 changed files with 44 additions and 1 deletions

View file

@ -1949,5 +1949,25 @@ failed_init:
module_init(netback_init);
static void __exit netback_fini(void)
{
int i, j;
xenvif_xenbus_fini();
for (i = 0; i < xen_netbk_group_nr; i++) {
struct xen_netbk *netbk = &xen_netbk[i];
del_timer_sync(&netbk->net_timer);
kthread_stop(netbk->task);
for (j = 0; j < MAX_PENDING_REQS; j++) {
if (netbk->mmap_pages[i])
__free_page(netbk->mmap_pages[i]);
}
}
vfree(xen_netbk);
}
module_exit(netback_fini);
MODULE_LICENSE("Dual BSD/GPL");
MODULE_ALIAS("xen-backend:vif");