netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eyal Birger <eyal.birger@gmail.com>
To: dsahern@kernel.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com
Cc: netdev@vger.kernel.org, Eyal Birger <eyal.birger@gmail.com>
Subject: [PATCH net] vrf: fix vrf driver unloading
Date: Wed, 25 May 2022 23:46:28 +0300	[thread overview]
Message-ID: <20220525204628.297931-1-eyal.birger@gmail.com> (raw)

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


             reply	other threads:[~2022-05-25 20:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-25 20:46 Eyal Birger [this message]
2022-05-25 21:12 ` [PATCH net] vrf: fix vrf driver unloading David Ahern
2022-05-26  7:35   ` Eyal Birger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220525204628.297931-1-eyal.birger@gmail.com \
    --to=eyal.birger@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).