netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] soreuseport: Resolve merge conflict for v4/v6 ordering fix
@ 2016-04-25 14:42 Craig Gallek
  2016-04-25 17:28 ` David Miller
  2016-04-25 17:33 ` Eric Dumazet
  0 siblings, 2 replies; 3+ messages in thread
From: Craig Gallek @ 2016-04-25 14:42 UTC (permalink / raw)
  To: davem; +Cc: netdev

From: Craig Gallek <kraig@google.com>

d894ba18d4e4 ("soreuseport: fix ordering for mixed v4/v6 sockets")
was merged as a bug fix to the net tree.  Two conflicting changes
were committed to net-next before the above fix was merged back to
net-next:
ca065d0cf80f ("udp: no longer use SLAB_DESTROY_BY_RCU")
3b24d854cb35 ("tcp/dccp: do not touch listener sk_refcnt under synflood")

These changes switched the datastructure used for TCP and UDP sockets
from hlist_nulls to hlist.  This patch applies the necessary parts
of the net tree fix to net-next which were not automatic as part of the
merge.

Fixes: 1602f49b58ab ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net")
Signed-off-by: Craig Gallek <kraig@google.com>
---
 include/net/sock.h         | 6 +++++-
 net/ipv4/inet_hashtables.c | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/include/net/sock.h b/include/net/sock.h
index 52448baf19d7..d6f26b3119aa 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -630,7 +630,11 @@ static inline void sk_add_node(struct sock *sk, struct hlist_head *list)
 static inline void sk_add_node_rcu(struct sock *sk, struct hlist_head *list)
 {
 	sock_hold(sk);
-	hlist_add_head_rcu(&sk->sk_node, list);
+	if (IS_ENABLED(CONFIG_IPV6) && sk->sk_reuseport &&
+	    sk->sk_family == AF_INET6)
+		hlist_add_tail_rcu(&sk->sk_node, list);
+	else
+		hlist_add_head_rcu(&sk->sk_node, list);
 }
 
 static inline void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list)
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index fcadb670f50b..b76b0d7e59c1 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -479,7 +479,11 @@ int __inet_hash(struct sock *sk, struct sock *osk,
 		if (err)
 			goto unlock;
 	}
-	hlist_add_head_rcu(&sk->sk_node, &ilb->head);
+	if (IS_ENABLED(CONFIG_IPV6) && sk->sk_reuseport &&
+		sk->sk_family == AF_INET6)
+		hlist_add_tail_rcu(&sk->sk_node, &ilb->head);
+	else
+		hlist_add_head_rcu(&sk->sk_node, &ilb->head);
 	sock_set_flag(sk, SOCK_RCU_FREE);
 	sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
 unlock:
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] soreuseport: Resolve merge conflict for v4/v6 ordering fix
  2016-04-25 14:42 [PATCH net-next] soreuseport: Resolve merge conflict for v4/v6 ordering fix Craig Gallek
@ 2016-04-25 17:28 ` David Miller
  2016-04-25 17:33 ` Eric Dumazet
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-04-25 17:28 UTC (permalink / raw)
  To: kraigatgoog; +Cc: netdev

From: Craig Gallek <kraigatgoog@gmail.com>
Date: Mon, 25 Apr 2016 10:42:12 -0400

> From: Craig Gallek <kraig@google.com>
> 
> d894ba18d4e4 ("soreuseport: fix ordering for mixed v4/v6 sockets")
> was merged as a bug fix to the net tree.  Two conflicting changes
> were committed to net-next before the above fix was merged back to
> net-next:
> ca065d0cf80f ("udp: no longer use SLAB_DESTROY_BY_RCU")
> 3b24d854cb35 ("tcp/dccp: do not touch listener sk_refcnt under synflood")
> 
> These changes switched the datastructure used for TCP and UDP sockets
> from hlist_nulls to hlist.  This patch applies the necessary parts
> of the net tree fix to net-next which were not automatic as part of the
> merge.
> 
> Fixes: 1602f49b58ab ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net")
> Signed-off-by: Craig Gallek <kraig@google.com>

Applied, thanks for taking care of this Craig.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] soreuseport: Resolve merge conflict for v4/v6 ordering fix
  2016-04-25 14:42 [PATCH net-next] soreuseport: Resolve merge conflict for v4/v6 ordering fix Craig Gallek
  2016-04-25 17:28 ` David Miller
@ 2016-04-25 17:33 ` Eric Dumazet
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2016-04-25 17:33 UTC (permalink / raw)
  To: Craig Gallek; +Cc: davem, netdev

On Mon, 2016-04-25 at 10:42 -0400, Craig Gallek wrote:
> From: Craig Gallek <kraig@google.com>
...
>  static inline void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list)
> diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
> index fcadb670f50b..b76b0d7e59c1 100644
> --- a/net/ipv4/inet_hashtables.c
> +++ b/net/ipv4/inet_hashtables.c
> @@ -479,7 +479,11 @@ int __inet_hash(struct sock *sk, struct sock *osk,
>  		if (err)
>  			goto unlock;
>  	}
> -	hlist_add_head_rcu(&sk->sk_node, &ilb->head);
> +	if (IS_ENABLED(CONFIG_IPV6) && sk->sk_reuseport &&
> +		sk->sk_family == AF_INET6)

Nit : alignment was wrong here.

cond1 & cond2 should be aligned as in :

if (cond1 &&
    cond2)


> +		hlist_add_tail_rcu(&sk->sk_node, &ilb->head);
> +	else
> +		hlist_add_head_rcu(&sk->sk_node, &ilb->head);
>  	sock_set_flag(sk, SOCK_RCU_FREE);
>  	sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
>  unlock:

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-25 17:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-25 14:42 [PATCH net-next] soreuseport: Resolve merge conflict for v4/v6 ordering fix Craig Gallek
2016-04-25 17:28 ` David Miller
2016-04-25 17:33 ` Eric Dumazet

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).