[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171007.032344.1464599410029867578.davem@davemloft.net>
Date: Sat, 07 Oct 2017 03:23:44 +0100 (WEST)
From: David Miller <davem@...emloft.net>
To: hideaki.yoshifuji@...aclelinux.com
Cc: weiwan@...gle.com, netdev@...r.kernel.org, edumazet@...gle.com,
kafai@...com, yoshfuji@...ux-ipv6.org
Subject: Re: [PATCH net-next 11/16] ipv6: replace dst_hold() with
dst_hold_safe() in routing code
From: 吉藤英明 <hideaki.yoshifuji@...aclelinux.com>
Date: Sat, 7 Oct 2017 08:57:49 +0900
> Hi,
>
> 2017-10-07 4:06 GMT+09:00 Wei Wang <weiwan@...gle.com>:
>> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
>> index 941c062389d2..aeb349aea429 100644
>> --- a/net/ipv6/route.c
>> +++ b/net/ipv6/route.c
> :
>> @@ -1625,12 +1643,17 @@ struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table,
>> if (rt_cache)
>> rt = rt_cache;
>>
>> - if (rt == net->ipv6.ip6_null_entry || (rt->rt6i_flags & RTF_CACHE)) {
>> - dst_use(&rt->dst, jiffies);
>> + if (rt == net->ipv6.ip6_null_entry) {
>> + read_unlock_bh(&table->tb6_lock);
>> + dst_hold(&rt->dst);
>> + trace_fib6_table_lookup(net, rt, table->tb6_id, fl6);
>> + return rt;
>> + } else if (rt->rt6i_flags & RTF_CACHE) {
>> + if (ip6_hold_safe(net, &rt, true)) {
>> + dst_use_noref(&rt->dst, jiffies);
>> + rt6_dst_from_metrics_check(rt);
>> + }
>> read_unlock_bh(&table->tb6_lock);
>> -
>> - rt6_dst_from_metrics_check(rt);
>> -
>> trace_fib6_table_lookup(net, rt, table->tb6_id, fl6);
>> return rt;
>> } else if (unlikely((fl6->flowi6_flags & FLOWI_FLAG_KNOWN_NH) &&
>
> Is it intended to move rt6_dst_from_metrics_check() inside the table lock?
That lock is replaced with rcu_read_unlock() or similar in patch #15 so I
don't think it matters much in the end.
Powered by blists - more mailing lists