Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Ido Schimmel <idosch@idosch.org>
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
roopa@nvidia.com, mlxsw@nvidia.com,
Ido Schimmel <idosch@nvidia.com>
Subject: Re: [RFC PATCH net-next 17/22] nexthop: Replay nexthops when registering a notifier
Date: Fri, 11 Sep 2020 10:47:13 -0600 [thread overview]
Message-ID: <74187436-6a30-2d44-de7f-0a52268b7f11@gmail.com> (raw)
In-Reply-To: <20200911164023.GJ3160975@shredder>
On 9/11/20 10:40 AM, Ido Schimmel wrote:
>>> @@ -2116,11 +2137,40 @@ static struct notifier_block nh_netdev_notifier = {
>>> .notifier_call = nh_netdev_event,
>>> };
>>>
>>> +static int nexthops_dump(struct net *net, struct notifier_block *nb,
>>> + struct netlink_ext_ack *extack)
>>> +{
>>> + struct rb_root *root = &net->nexthop.rb_root;
>>> + struct rb_node *node;
>>> + int err = 0;
>>> +
>>> + for (node = rb_first(root); node; node = rb_next(node)) {
>>> + struct nexthop *nh;
>>> +
>>> + nh = rb_entry(node, struct nexthop, rb_node);
>>> + err = call_nexthop_notifier(nb, net, NEXTHOP_EVENT_REPLACE, nh,
>>> + extack);
>>> + if (err)
>>> + break;
>>> + }
>>> +
>>> + return err;
>>> +}
>>> +
>>> int register_nexthop_notifier(struct net *net, struct notifier_block *nb,
>>> struct netlink_ext_ack *extack)
>>> {
>>> - return blocking_notifier_chain_register(&net->nexthop.notifier_chain,
>>> - nb);
>>> + int err;
>>> +
>>> + rtnl_lock();
>>> + err = nexthops_dump(net, nb, extack);
>>
>> can the unlock be moved here? register function below should not need it.
>
> It can result in this unlikely race:
>
> <t0> - rtnl_lock(); nexthops_dump(); rtnl_unlock()
> <t1> - Nexthop is added / deleted
> <t2> - blocking_notifier_chain_register()
>
ok. Let's keep the order you have which I believe is consistent with FIB
notifiers.
next prev parent reply other threads:[~2020-09-11 16:47 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-08 9:10 [RFC PATCH net-next 00/22] nexthop: Add support for nexthop objects offload Ido Schimmel
2020-09-08 9:10 ` [RFC PATCH net-next 01/22] nexthop: Remove unused function declaration from header file Ido Schimmel
2020-09-08 14:29 ` David Ahern
2020-09-08 9:10 ` [RFC PATCH net-next 02/22] nexthop: Convert to blocking notification chain Ido Schimmel
2020-09-08 14:34 ` David Ahern
2020-09-08 9:10 ` [RFC PATCH net-next 03/22] nexthop: Only emit a notification when nexthop is actually deleted Ido Schimmel
2020-09-08 14:34 ` David Ahern
2020-09-08 14:39 ` Jiri Pirko
2020-09-08 14:42 ` David Ahern
2020-09-11 14:40 ` Ido Schimmel
2020-09-08 9:10 ` [RFC PATCH net-next 04/22] selftests: fib_nexthops: Test cleanup of FDB entries following nexthop deletion Ido Schimmel
2020-09-08 14:35 ` David Ahern
2020-09-08 9:10 ` [RFC PATCH net-next 05/22] nexthop: Add nexthop notification data structures Ido Schimmel
2020-09-08 14:43 ` David Ahern
2020-09-11 14:50 ` Ido Schimmel
2020-09-08 9:10 ` [RFC PATCH net-next 06/22] nexthop: Pass extack to nexthop notifier Ido Schimmel
2020-09-08 14:44 ` David Ahern
2020-09-08 9:10 ` [RFC PATCH net-next 07/22] nexthop: Prepare new notification info Ido Schimmel
2020-09-08 14:55 ` David Ahern
2020-09-11 15:01 ` Ido Schimmel
2020-09-08 9:10 ` [RFC PATCH net-next 08/22] nexthop: vxlan: Convert to " Ido Schimmel
2020-09-08 14:58 ` David Ahern
2020-09-11 15:05 ` Ido Schimmel
2020-09-08 9:10 ` [RFC PATCH net-next 09/22] rtnetlink: Add RTNH_F_TRAP flag Ido Schimmel
2020-09-08 15:02 ` David Ahern
2020-09-11 15:26 ` Ido Schimmel
2020-09-11 15:54 ` David Ahern
2020-09-08 9:10 ` [RFC PATCH net-next 10/22] nexthop: Allow setting "offload" and "trap" indications on nexthops Ido Schimmel
2020-09-08 15:14 ` David Ahern
2020-09-11 15:29 ` Ido Schimmel
2020-09-08 9:10 ` [RFC PATCH net-next 11/22] nexthop: Emit a notification when a nexthop is added Ido Schimmel
2020-09-08 15:21 ` David Ahern
2020-09-11 16:20 ` Ido Schimmel
2020-09-08 9:10 ` [RFC PATCH net-next 12/22] nexthop: Emit a notification when a nexthop group is replaced Ido Schimmel
2020-09-08 15:22 ` David Ahern
2020-09-08 9:10 ` [RFC PATCH net-next 13/22] nexthop: Emit a notification when a single nexthop " Ido Schimmel
2020-09-08 15:25 ` David Ahern
2020-09-11 16:24 ` Ido Schimmel
2020-09-08 9:10 ` [RFC PATCH net-next 14/22] nexthop: Emit a notification when a nexthop group is modified Ido Schimmel
2020-09-08 15:29 ` David Ahern
2020-09-08 9:10 ` [RFC PATCH net-next 15/22] nexthop: Emit a notification when a nexthop group is reduced Ido Schimmel
2020-09-08 15:33 ` David Ahern
2020-09-11 16:29 ` Ido Schimmel
2020-09-08 9:10 ` [RFC PATCH net-next 16/22] nexthop: Pass extack to register_nexthop_notifier() Ido Schimmel
2020-09-08 15:34 ` David Ahern
2020-09-08 9:10 ` [RFC PATCH net-next 17/22] nexthop: Replay nexthops when registering a notifier Ido Schimmel
2020-09-08 15:37 ` David Ahern
2020-09-11 16:40 ` Ido Schimmel
2020-09-11 16:47 ` David Ahern [this message]
2020-09-08 9:10 ` [RFC PATCH net-next 18/22] nexthop: Remove in-kernel route notifications when nexthop changes Ido Schimmel
2020-09-08 15:38 ` David Ahern
2020-09-08 9:10 ` [RFC PATCH net-next 19/22] netdevsim: Add devlink resource for nexthops Ido Schimmel
2020-09-08 9:10 ` [RFC PATCH net-next 20/22] netdevsim: Add dummy implementation for nexthop offload Ido Schimmel
2020-09-08 9:10 ` [RFC PATCH net-next 21/22] netdevsim: Allow programming routes with nexthop objects Ido Schimmel
2020-09-08 15:40 ` David Ahern
2020-09-08 9:10 ` [RFC PATCH net-next 22/22] selftests: netdevsim: Add test for nexthop offload API Ido Schimmel
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=74187436-6a30-2d44-de7f-0a52268b7f11@gmail.com \
--to=dsahern@gmail.com \
--cc=davem@davemloft.net \
--cc=idosch@idosch.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=mlxsw@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=roopa@nvidia.com \
--subject='Re: [RFC PATCH net-next 17/22] nexthop: Replay nexthops when registering a notifier' \
/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
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).