netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: 吉藤英明 <hideaki.yoshifuji@miraclelinux.com>
To: Wei Wang <weiwan@google.com>
Cc: "David Miller" <davem@davemloft.net>,
	"network dev" <netdev@vger.kernel.org>,
	"Eric Dumazet" <edumazet@google.com>,
	"Martin KaFai Lau" <kafai@fb.com>,
	吉藤英明 <hideaki.yoshifuji@miraclelinux.com>,
	"YOSHIFUJI Hideaki" <yoshfuji@linux-ipv6.org>
Subject: Re: [PATCH net-next 11/16] ipv6: replace dst_hold() with dst_hold_safe() in routing code
Date: Sat, 7 Oct 2017 08:57:49 +0900	[thread overview]
Message-ID: <CAPA1RqB14m4BERjrOO5Fryu2WAU9iwqAbC8H7Sb_bNUi9jfLAg@mail.gmail.com> (raw)
In-Reply-To: <20171006190611.110633-12-tracywwnj@gmail.com>

Hi,

2017-10-07 4:06 GMT+09:00 Wei Wang <weiwan@google.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?

--yoshfuji

  parent reply	other threads:[~2017-10-06 23:58 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-06 19:05 [PATCH net-next 00/16] ipv6: replace rwlock with rcu and spinlock in fib6 table Wei Wang
2017-10-06 19:05 ` [PATCH net-next 01/16] ipv6: introduce a new function fib6_update_sernum() Wei Wang
2017-10-06 19:05   ` [PATCH net-next 02/16] ipv6: introduce a hash table to store dst cache Wei Wang
2017-10-06 19:05     ` [PATCH net-next 03/16] ipv6: prepare fib6_remove_prefsrc() for exception table Wei Wang
2017-10-06 19:05       ` [PATCH net-next 04/16] ipv6: prepare rt6_mtu_change() " Wei Wang
2017-10-06 19:06         ` [PATCH net-next 05/16] ipv6: prepare rt6_clean_tohost() " Wei Wang
2017-10-06 19:06           ` [PATCH net-next 06/16] ipv6: prepare fib6_age() " Wei Wang
2017-10-06 19:06             ` [PATCH net-next 07/16] ipv6: prepare fib6_locate() " Wei Wang
2017-10-06 19:06               ` [PATCH net-next 08/16] ipv6: hook up exception table to store dst cache Wei Wang
2017-10-06 19:06                 ` [PATCH net-next 09/16] ipv6: grab rt->rt6i_ref before allocating pcpu rt Wei Wang
2017-10-06 19:06                   ` [PATCH net-next 10/16] ipv6: don't release rt->rt6i_pcpu memory during rt6_release() Wei Wang
2017-10-06 19:06                     ` [PATCH net-next 11/16] ipv6: replace dst_hold() with dst_hold_safe() in routing code Wei Wang
2017-10-06 19:06                       ` [PATCH net-next 12/16] ipv6: update fn_sernum after route is inserted to tree Wei Wang
2017-10-06 19:06                         ` [PATCH net-next 13/16] ipv6: check fn->leaf before it is used Wei Wang
2017-10-06 19:06                           ` [PATCH net-next 14/16] ipv6: add key length check into rt6_select() Wei Wang
2017-10-06 19:06                             ` [PATCH net-next 15/16] ipv6: replace rwlock with rcu and spinlock in fib6_table Wei Wang
2017-10-06 19:06                               ` [PATCH net-next 16/16] ipv6: take care of rt6_stats Wei Wang
2017-10-06 23:57                       ` 吉藤英明 [this message]
2017-10-07  2:06                         ` [PATCH net-next 11/16] ipv6: replace dst_hold() with dst_hold_safe() in routing code Wei Wang
2017-10-07  2:23                         ` David Miller
2017-10-06 23:49 ` [PATCH net-next 00/16] ipv6: replace rwlock with rcu and spinlock in fib6 table Eric Dumazet
2017-10-07  9:25   ` 吉藤英明
2017-10-07 20:28     ` David Miller
2017-10-09  3:43 ` BUG: using smp_processor_id() in preemptible [00000000] Jakub Kicinski
2017-10-09  3:47   ` Eric Dumazet
2017-10-09  3:50     ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPA1RqB14m4BERjrOO5Fryu2WAU9iwqAbC8H7Sb_bNUi9jfLAg@mail.gmail.com \
    --to=hideaki.yoshifuji@miraclelinux.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kafai@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=weiwan@google.com \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).