Subject: Re: [patch net-next] vrf: add exit function and allow module unload

From: David Ahern <[email-masked]>
Date: Wed, 4 May 2016 10:05:28 -0600

On 5/4/16 4:23 AM, Hannes Frederic Sowa wrote:
> Hello Jiri,
>
> On Wed, May 4, 2016, at 12:20, Jiri Pirko wrote:
>>   drivers/net/vrf.c | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
>> index 8a8f1e5..b217c2d 100644
>> --- a/drivers/net/vrf.c
>> +++ b/drivers/net/vrf.c
>> @@ -839,7 +839,14 @@ error:
>>   	return rc;
>>   }
>>
>> +static void __exit vrf_exit_module(void)
>> +{
>> +       rtnl_link_unregister(&vrf_link_ops);
>> +       unregister_netdevice_notifier(&vrf_notifier_block);
>> +}
>> +
>>   module_init(vrf_init_module);
>> +module_exit(vrf_exit_module);
>
> The dst_entries created by vrf don't carry a reference to THIS_MODULE
> but have a code dependency to the vrf module (e.g. via
> vrf_output/vrf_output6) that gets published. This is exactly the same
> why ipv6 cannot be unloaded.

exactly. The module exit was removed recently by 9ab179d83b4e ("net: 
vrf: Fix dst reference counting")