netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] vrf: fix vrf driver unloading
@ 2022-05-25 20:46 Eyal Birger
  2022-05-25 21:12 ` David Ahern
  0 siblings, 1 reply; 3+ messages in thread
From: Eyal Birger @ 2022-05-25 20:46 UTC (permalink / raw)
  To: dsahern, davem, edumazet, kuba, pabeni; +Cc: netdev, Eyal Birger

The commit referenced in the "Fixes" tag has removed the vrf driver
cleanup function leading to a "Device or resource busy" error when
trying to rmmod vrf.

Fix by re-introducing the cleanup function with the relevant changes.

Fixes: 9ab179d83b4e ("net: vrf: Fix dst reference counting")
Signed-off-by: Eyal Birger <eyal.birger@gmail.com>

----

Note: the commit message in 9ab179d83b4e did not document it
and it is not apparent to me why the ability to rmmod the driver is
linked to that change, but maybe there's some hidden reason.
---
 drivers/net/vrf.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index cfc30ce4c6e1..7dff865d7283 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -2064,7 +2064,17 @@ static int __init vrf_init_module(void)
 	return rc;
 }
 
+static void __exit vrf_cleanup_module(void)
+{
+	rtnl_link_unregister(&vrf_link_ops);
+	l3mdev_table_lookup_unregister(L3MDEV_TYPE_VRF,
+				       vrf_ifindex_lookup_by_table_id);
+	unregister_pernet_subsys(&vrf_net_ops);
+	unregister_netdevice_notifier(&vrf_notifier_block);
+}
+
 module_init(vrf_init_module);
+module_exit(vrf_cleanup_module);
 MODULE_AUTHOR("Shrijeet Mukherjee, David Ahern");
 MODULE_DESCRIPTION("Device driver to instantiate VRF domains");
 MODULE_LICENSE("GPL");
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-26  7:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-25 20:46 [PATCH net] vrf: fix vrf driver unloading Eyal Birger
2022-05-25 21:12 ` David Ahern
2022-05-26  7:35   ` Eyal Birger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).