Commit f2f2325e authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

ip6mr: ip6mr_sk_done() can exit early in common cases



In many cases, ip6mr_sk_done() is called while no ipmr socket
has been registered.

This removes 4 rtnl acquisitions per netns dismantle,
with following callers:

igmp6_net_exit(), tcpv6_net_exit(), ndisc_net_exit()

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 145c7a79
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1575,6 +1575,9 @@ int ip6mr_sk_done(struct sock *sk)
	    inet_sk(sk)->inet_num != IPPROTO_ICMPV6)
		return err;

	if (!atomic_read(&net->ipv6.devconf_all->mc_forwarding))
		return err;

	rtnl_lock();
	ip6mr_for_each_table(mrt, net) {
		if (sk == rtnl_dereference(mrt->mroute_sk)) {