From: Cong Wang <xiyou.wangcong@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David Miller <davem@davemloft.net>,
Linux Kernel Network Developers <netdev@vger.kernel.org>,
Andrey Konovalov <andreyknvl@google.com>,
Eric Dumazet <edumazet@google.com>
Subject: Re: [Patch net] ipv4: restore rt->fi for reference counting
Date: Tue, 9 May 2017 16:35:57 -0700 [thread overview]
Message-ID: <CAM_iQpU+fXO7eFroAYMv6vqDzCK_ZYXjrTPAMfoDR2BDqaK9rQ@mail.gmail.com> (raw)
In-Reply-To: <1494371348.7796.95.camel@edumazet-glaptop3.roam.corp.google.com>
On Tue, May 9, 2017 at 4:09 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Tue, 2017-05-09 at 15:54 -0700, Eric Dumazet wrote:
>> On Tue, 2017-05-09 at 15:52 -0700, Eric Dumazet wrote:
>> > On Tue, 2017-05-09 at 15:07 -0700, Cong Wang wrote:
>> > > On Tue, May 9, 2017 at 1:56 PM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
>> > > > Wait... if we transfer dst->dev to loopback_dev because we don't
>> > > > want to block unregister path, then we might have a similar problem
>> > > > for rt->fi too, fib_info is still referenced by dst, so these nh_dev's still
>> > > > hold the dev references...
>> > > >
>> > >
>> > > I finally come up with the attach patch... Do you mind to give it a try?
>> >
>> > I will, but this might be delayed by a few hours.
>> >
>> > In the mean time, it looks like you could try adding the following to
>> > your .config ;)
>> >
>> > CONFIG_IP_ROUTE_MULTIPATH=y
>> >
>> >
>>
>> + /* This should be fine, we are on unregister
>> + * path so synchronize_net() already waits for
>> + * existing readers. We have to release the
>> + * dev here because dst could still hold this
>> + * fib_info via rt->fi, we can't wait for GC.
>> + */
>> + RCU_INIT_POINTER(nexthop_nh->nh_dev, NULL);
>> + dev_put(dev);
>> dead = fi->fib_nhs;
>>
>> dead = fi->fib_mhs looks wrong if you remove the break; statement ?
>>
>> - break;
This statement is only used to ensure we pass the "dead == fi->fib_nhs"
check right below the inner loop, it is fine to keep it without break since
fi is not changed in the inner loop.
>
> Also setting nexthop_nh->nh_dev to NULL looks quite dangerous
>
> We have plenty of sites doing :
>
> if (fi->fib_dev)
> x = fi->fib_dev->field
>
> fib_route_seq_show() is one example.
>
All of them take RCU read lock, so, as I explained in the code comment,
they all should be fine because of synchronize_net() on unregister path.
Do you see anything otherwise?
next prev parent reply other threads:[~2017-05-09 23:36 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-04 21:54 [Patch net] ipv4: restore rt->fi for reference counting Cong Wang
2017-05-07 18:53 ` Eric Dumazet
2017-05-08 18:35 ` David Miller
2017-05-09 0:01 ` Eric Dumazet
2017-05-09 1:22 ` David Miller
2017-05-09 2:18 ` Eric Dumazet
2017-05-09 2:35 ` David Miller
2017-05-09 16:44 ` Cong Wang
2017-05-09 16:56 ` Eric Dumazet
2017-05-09 20:56 ` Cong Wang
2017-05-09 22:07 ` Cong Wang
2017-05-09 22:52 ` Eric Dumazet
2017-05-09 22:54 ` Eric Dumazet
2017-05-09 23:09 ` Eric Dumazet
2017-05-09 23:35 ` Cong Wang [this message]
2017-05-09 23:50 ` Eric Dumazet
2017-05-10 16:32 ` Cong Wang
2017-05-09 23:51 ` Eric Dumazet
2017-05-10 16:40 ` Cong Wang
2017-05-10 7:38 ` Julian Anastasov
2017-05-10 17:00 ` Cong Wang
2017-05-10 19:51 ` Julian Anastasov
2017-05-12 0:07 ` Cong Wang
2017-05-12 1:22 ` Cong Wang
2017-05-12 4:55 ` Eric Dumazet
2017-05-12 17:49 ` Cong Wang
2017-05-12 6:39 ` Julian Anastasov
2017-05-12 17:27 ` Cong Wang
2017-05-12 20:58 ` Cong Wang
2017-05-12 21:13 ` Cong Wang
2017-05-12 21:27 ` Julian Anastasov
2017-05-15 18:34 ` Cong Wang
2017-05-15 20:37 ` Julian Anastasov
2017-05-15 22:13 ` Cong Wang
2017-05-16 7:46 ` Julian Anastasov
2017-05-16 17:53 ` Cong Wang
2017-05-16 18:16 ` Cong Wang
[not found] ` <1495572267.6465.79.camel@edumazet-glaptop3.roam.corp.google.com>
[not found] ` <CAM_iQpX0X3h4Sf+bHUXdJgBqUTxNat0FBT0PeRpLYWju9ci59Q@mail.gmail.com>
[not found] ` <CANn89i+mPR+7-AVO2Dsd=KfO=COOVY42AKjwEs=0=GUCML6HUQ@mail.gmail.com>
[not found] ` <CAM_iQpUfLmN3yWsCfpx4ZTptBnuYFNuY5CjBKdwoDpvH5K8P=w@mail.gmail.com>
[not found] ` <1495665921.6465.95.camel@edumazet-glaptop3.roam.corp.google.com>
2017-05-25 21:27 ` [PATCH net] ipv4: add reference counting to metrics Eric Dumazet
2017-05-25 22:25 ` Julian Anastasov
2017-05-26 17:08 ` Cong Wang
2017-05-26 17:13 ` Eric Dumazet
2017-05-26 17:26 ` Cong Wang
2017-05-26 18:58 ` David Miller
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=CAM_iQpU+fXO7eFroAYMv6vqDzCK_ZYXjrTPAMfoDR2BDqaK9rQ@mail.gmail.com \
--to=xiyou.wangcong@gmail.com \
--cc=andreyknvl@google.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.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).