Re: BUG: selftest/net/tun: Hang in unregister_netdevice

From: Eric Dumazet
Date: Tue Mar 14 2023 - 12:03:37 EST


On Tue, Mar 14, 2023 at 9:01 AM Mirsad Todorovac
<mirsad.todorovac@xxxxxxxxxxxx> wrote:

> After a while, kernel message start looping:
>
> kernel:unregister_netdevice: waiting for tap0 to become free. Usage count = 3
>
> Message from syslogd@pc-mtodorov at Mar 14 16:57:15 ...
> kernel:unregister_netdevice: waiting for tap0 to become free. Usage count = 3
>
> Message from syslogd@pc-mtodorov at Mar 14 16:57:24 ...
> kernel:unregister_netdevice: waiting for tap0 to become free. Usage count = 3
>
> Message from syslogd@pc-mtodorov at Mar 14 16:57:26 ...
> kernel:unregister_netdevice: waiting for tap0 to become free. Usage count = 3
>
> This hangs processes until very late stage of shutdown.
>
> I can confirm that CONFIG_DEBUG_{KOBJECT,KOBJECT_RELEASE}=y were the only changes
> to .config in between builds.
>
> Best regards,
> Mirsad
>

Try adding in your config

CONFIG_NET_DEV_REFCNT_TRACKER=y
CONFIG_NET_NS_REFCNT_TRACKER=y

Thanks.