lkml.org 
[lkml]   [2019]   [Jun]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH bpf v4 2/2] xdp: fix hang while unregistering device bound to xdp socket
From
Date
On 26.06.2019 21:34, Jakub Kicinski wrote:
> On Wed, 26 Jun 2019 21:15:15 +0300, Ilya Maximets wrote:
>> diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c
>> index 267b82a4cbcf..56729e74cbea 100644
>> --- a/net/xdp/xdp_umem.c
>> +++ b/net/xdp/xdp_umem.c
>> @@ -140,34 +140,38 @@ int xdp_umem_assign_dev(struct xdp_umem *umem, struct net_device *dev,
>> return err;
>> }
>>
>> -static void xdp_umem_clear_dev(struct xdp_umem *umem)
>> +void xdp_umem_clear_dev(struct xdp_umem *umem)
>> {
>> + bool lock = rtnl_is_locked();
>
> How do you know it's not just locked by someone else? You need to pass
> the locked state in if this is called from different paths, some of
> which already hold rtnl.

Oh. That's a shame. I need more sleep.

Thanks for spotting. I'll re-work this part.

Best regards, Ilya Maximets.

>
> Preferably factor the code which needs the lock out into a separate
> function like this:
>
> void __function()
> {
> do();
> the();
> things();
> under();
> the();
> lock();
> }
>
> void function()
> {
> rtnl_lock();
> __function();
> rtnl_unlock();
> }
>
>> struct netdev_bpf bpf;
>> int err;
>>
>> + if (!lock)
>> + rtnl_lock();
>
>
>

\
 
 \ /
  Last update: 2019-06-27 09:24    [W:2.595 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site