Re: [PATCH net-next v3 08/24] ovpn: introduce the ovpn_socket object

Antonio Quartulli
2024-05-09T13:45:36Z

On 09/05/2024 15:32, Sabrina Dubroca wrote:
> 2024-05-08, 22:38:58 +0200, Antonio Quartulli wrote:
>> On 08/05/2024 19:10, Sabrina Dubroca wrote:
>>> 2024-05-06, 03:16:21 +0200, Antonio Quartulli wrote:
>>>> diff --git a/drivers/net/ovpn/socket.c b/drivers/net/ovpn/socket.c
>>>> new file mode 100644
>>>> index 000000000000..a4a4d69162f0
>>>> --- /dev/null
>>>> +++ b/drivers/net/ovpn/socket.c
>>> [...]
>>>> +
>>>> +/* Finalize release of socket, called after RCU grace period */
>>>
>>> kref_put seems to call ovpn_socket_release_kref without waiting, and
>>> then that calls ovpn_socket_detach immediately as well. Am I missing
>>> something?
>>
>> hmm what do we need to wait for exactly? (Maybe I am missing something)
>> The ovpn_socket will survive a bit longer thanks to kfree_rcu.
>
> The way I read this comment, it says that ovpn_socket_detach will be
> called after one RCU grace period, but I don't see where that grace
> period would come from.
>
> ovpn_socket_put -> kref_put(release=ovpn_socket_release_kref) ->
> ovpn_socket_release_kref -> ovpn_socket_detach
>
> No grace period here.
>
> Or am I misinterpreting the comment? There will be a grace period
> caused by kfree_rcu before the ovpn_socket is actually freed, is that
> what the comment means?

Forgive me - only now I realized that you were referring to what the
comment says.

That comment is just totally busted. I think it was there since the code
was doing something totally different and was carried over and over by
mistake.

Sorry

--
Antonio Quartulli
OpenVPN Inc.