[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <dfeb092a-21ba-386c-11e4-584fd936743a@gmail.com>
Date: Mon, 21 Mar 2022 19:28:06 +0100
From: Niels Dossche <dossche.niels@...il.com>
To: Paolo Abeni <pabeni@...hat.com>, David Ahern <dsahern@...nel.org>,
netdev@...r.kernel.org
Cc: "David S. Miller" <davem@...emloft.net>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH v2] ipv6: acquire write lock for addr_list in
dev_forward_change
On 21/03/2022 19:15, Paolo Abeni wrote:
> On Mon, 2022-03-21 at 09:42 -0600, David Ahern wrote:
>> On 3/19/22 7:17 AM, Niels Dossche wrote:
>>> I have an additional question about the locks on the addr_list actually.
>>> In addrconf_ifdown, there's a loop on addr_list within a write lock in idev->lock
>>>> list_for_each_entry_safe(ifa, tmp, &idev->addr_list, if_list)
>>> The loop body unlocks the idev->lock and reacquires it later. I assume because of the lock dependency on ifa->lock and the calls that acquire the mc_lock? Shouldn't that list iteration also be protected during the whole iteration?
>>>
>>
>>
>> That loop needs to be improved as well. Locking in ipv6 code is a bit
>> hairy.
>
> I *think* we could re-use the if_list_aux trick: create a tmp list
> under idev->lock using ifa->if_list_aux and traverse (still using the
> _safe variant) such list with no lock.
>
This sounds like a good plan.
> Still in addrconf_ifdown(), there is a similar loop for
> 'tempaddr_list'.
>
> In the latter case I think we could splice the idev->lock protected
> list into a tmp one and traverse the latter with no lock held.
>
> @Niels: could you look at that, too?
I will be able to look into this tomorrow in more detail, I'll try then to create a patch series.
>
> Thanks!
>
> Paolo
>
Cheers
Niels
Powered by blists - more mailing lists