[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpWXL6MgYa2zV=7Kmv9NJBYGiTcQdZe7JRzFGougzGByqw@mail.gmail.com>
Date: Wed, 10 Sep 2014 14:32:30 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: Hannes Frederic Sowa <hannes@...essinduktion.org>
Cc: Linux Kernel Network Developers <netdev@...r.kernel.org>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [Patch net-next 3/5] ipv6: clean up ipv6_dev_ac_inc()
On Wed, Sep 10, 2014 at 5:23 AM, Hannes Frederic Sowa
<hannes@...essinduktion.org> wrote:
> On Di, 2014-09-09 at 16:52 -0700, Cong Wang wrote:
>> + in6_dev_hold(idev);
>
> Please move this in6_dev_hold down to where it gets attached to the
> ifacaddr6 and remove the in6_dev_put from below the out: label.
I thought it is for idev->lock in case of idev becomes a wild pointer
as well, but it seems its callers or at least RTNL should guarantee
idev is still valid. So yeah, then we can probably move it down.
>
>> write_lock_bh(&idev->lock);
>> if (idev->dead) {
>> err = -ENODEV;
>> @@ -267,7 +262,7 @@ int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr)
>> aca->aca_users = 1;
>> /* aca_tstamp should be updated upon changes */
>> aca->aca_cstamp = aca->aca_tstamp = jiffies;
>> - atomic_set(&aca->aca_refcnt, 2);
>> + atomic_set(&aca->aca_refcnt, 1);
>> spin_lock_init(&aca->aca_lock);
>>
>> aca->aca_next = idev->ac_list;
>> @@ -276,9 +271,7 @@ int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr)
>>
>> ip6_ins_rt(rt);
>>
>> - addrconf_join_solict(dev, &aca->aca_addr);
>> -
>> - aca_put(aca);
>
> I am not sure why you changed the aca_refcnt code. idev->ac_list is only
> protected by idev->lock and you publish one reference and unlock, thus
> you need a second reference during addrconf_join_solict. All accesses
> should also be protected by rtnl, so it shouldn't be a problem, but if
> people review the code they might have problems to figure that out.
> Maybe you can also remove the idev->lock?
>
I was misled by the code, it is not easy to understand this since there
is no comment. I will refactor the code to make it more readable and
of course in a separated patch.
Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists