From: David Ahern <dsahern@gmail.com>
To: netdev@vger.kernel.org, idosch@mellanox.com
Cc: jiri@mellanox.com, kjlx@templeofstupid.com
Subject: Re: [RFC net-next 1/4] net: ipv6: Make inet6addr_validator a blocking notifier
Date: Tue, 10 Oct 2017 13:32:22 -0600 [thread overview]
Message-ID: <899f892c-1f1f-33dd-1d55-310c215c33e8@gmail.com> (raw)
In-Reply-To: <1507653665-20540-2-git-send-email-dsahern@gmail.com>
On 10/10/17 10:41 AM, David Ahern wrote:
> @@ -988,16 +987,23 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
> goto out2;
> }
>
> - i6vi.i6vi_addr = *addr;
> - i6vi.i6vi_dev = idev;
> - rcu_read_unlock_bh();
> + /* validator notifier needs to be blocking;
> + * do not call in softirq context
> + */
> + if (!in_softirq()) {
> + struct in6_validator_info i6vi = {
> + .i6vi_addr = *addr,
> + .i6vi_dev = idev,
> + };
>
> - err = inet6addr_validator_notifier_call_chain(NETDEV_UP, &i6vi);
> + rcu_read_unlock_bh();
> + err = inet6addr_validator_notifier_call_chain(NETDEV_UP, &i6vi);
> + rcu_read_lock_bh();
>
> - rcu_read_lock_bh();
> - err = notifier_to_errno(err);
> - if (err)
> - goto out2;
> + err = notifier_to_errno(err);
> + if (err)
> + goto out2;
> + }
>
> spin_lock(&addrconf_hash_lock);
>
The rcu_read_unlock_bh needs to be done before the in_softirq check.
With the change below I get the RIF overload with IPv6 addresses and I
verified the validator is skipped for RAs.
$ ip -batch vlan-ipv6-addr-batch
Error: spectrum: Exceeded number of supported router interfaces.
Command failed vlan-ipv6-addr-batch:683
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 0bad4a800f73..d9c5b29a3b8b 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -988,6 +988,8 @@ ipv6_add_addr(struct inet6_dev *idev, const struct
in6_addr *addr,
goto out2;
}
+ rcu_read_unlock_bh();
+
/* validator notifier needs to be blocking;
* do not call in softirq context
*/
@@ -998,15 +1000,14 @@ ipv6_add_addr(struct inet6_dev *idev, const
struct in6_addr *addr,
.extack = extack,
};
- rcu_read_unlock_bh();
err = inet6addr_validator_notifier_call_chain(NETDEV_UP,
&i6vi);
- rcu_read_lock_bh();
-
err = notifier_to_errno(err);
if (err)
- goto out2;
+ goto out1;
}
+ rcu_read_lock_bh();
+
spin_lock(&addrconf_hash_lock);
/* Ignore adding duplicate addresses on an interface */
@@ -1079,7 +1080,7 @@ ipv6_add_addr(struct inet6_dev *idev, const struct
in6_addr *addr,
write_unlock(&idev->lock);
out2:
rcu_read_unlock_bh();
-
+out1:
if (likely(err == 0))
inet6addr_notifier_call_chain(NETDEV_UP, ifa);
else {
next prev parent reply other threads:[~2017-10-10 19:32 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-10 16:41 [RFC net-next 0/4] mlxsw: spectrum_router: Add extack messages for RIF and VRF overflow David Ahern
2017-10-10 16:41 ` [RFC net-next 1/4] net: ipv6: Make inet6addr_validator a blocking notifier David Ahern
2017-10-10 19:32 ` David Ahern [this message]
2017-10-11 13:08 ` Ido Schimmel
2017-10-11 21:13 ` David Miller
2017-10-11 21:56 ` David Ahern
2017-10-10 16:41 ` [RFC net-next 2/4] net: Add extack to validator_info structs used for address notifier David Ahern
2017-10-11 13:37 ` Ido Schimmel
2017-10-10 16:41 ` [RFC net-next 3/4] mlxsw: spectrum: router: Add support for address validator notifier David Ahern
2017-10-11 13:54 ` Ido Schimmel
2017-10-11 15:19 ` David Ahern
2017-10-10 16:41 ` [RFC net-next 4/4] mlxsw: spectrum_router: Add extack message for RIF and VRF overflow David Ahern
2017-10-11 14:13 ` Ido Schimmel
2017-10-11 15:07 ` David Ahern
2017-10-11 15:10 ` 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=899f892c-1f1f-33dd-1d55-310c215c33e8@gmail.com \
--to=dsahern@gmail.com \
--cc=idosch@mellanox.com \
--cc=jiri@mellanox.com \
--cc=kjlx@templeofstupid.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).