Skip to contentSkip to conversation

netfilter updates for davem's net tree

PATCH In review [email protected] 2 participants 5 messages Oct 12, 2011 – Oct 17, 2011

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

cover netfilter updates for davem's net tree

From: Pablo Neira Ayuso <[email protected]>

Hi Dave,

The following patches are two bugfixes for your net tree. One regarding the conntrack event infrastructure with GRE traffic and one fix to resolve one deadlock in the IPVS state synchronization.

You can pull these changes from (my nf branch):

git://1984.lsi.us.es/net nf

Florian Westphal (1):
netfilter: nf_conntrack: fix event flooding in GRE protocol tracker

Hans Schillstrom (1):
ipvs: netns shutdown/startup dead-lock

 include/net/ip_vs.h                    |    1 +
 net/netfilter/ipvs/ip_vs_ctl.c         |  131 +++++++++++++++++++------------
 net/netfilter/ipvs/ip_vs_sync.c        |    6 ++
 net/netfilter/nf_conntrack_proto_gre.c |    4 +-
 4 files changed, 89 insertions(+), 53 deletions(-)
Signature · 1 line
1.7.2.5
author maintainer
#1 lore raw

PATCH 1/2 netfilter: nf_conntrack: fix event flooding in GRE protocol tracker

From: Florian Westphal <[email protected]>

GRE connections cause ctnetlink event flood because the ASSURED event is set for every packet received.

---
 net/netfilter/nf_conntrack_proto_gre.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nf_conntrack_proto_gre.c +2 -2
index cf616e5..d69facd 100644
@@ -241,8 +241,8 @@ static int gre_packet(struct nf_conn *ct,
 		nf_ct_refresh_acct(ct, ctinfo, skb,
 				   ct->proto.gre.stream_timeout);
 		/* Also, more likely to be important, and not a probe. */
-		set_bit(IPS_ASSURED_BIT, &ct->status);
-		nf_conntrack_event_cache(IPCT_ASSURED, ct);
+		if (!test_and_set_bit(IPS_ASSURED_BIT, &ct->status))
+			nf_conntrack_event_cache(IPCT_ASSURED, ct);
 	} else
 		nf_ct_refresh_acct(ct, ctinfo, skb,
 				   ct->proto.gre.timeout);
Signature · 1 line
1.7.2.5
author maintainer
#2 lore raw

PATCH 2/2 ipvs: netns shutdown/startup dead-lock

In reply to [email protected]

From: Hans Schillstrom <[email protected]>

ip_vs_mutext is used by both netns shutdown code and startup and both implicit uses sk_lock-AF_INET mutex.

cleanup CPU-1 startup CPU-2
ip_vs_dst_event() ip_vs_genl_set_cmd()
sk_lock-AF_INET __ip_vs_mutex
sk_lock-AF_INET
__ip_vs_mutex
* DEAD LOCK *

A new mutex placed in ip_vs netns struct called sync_mutex is added.

Comments from Julian and Simon added.
This patch has been running for more than 3 month now and it seems to work.

Ver. 3
IP_VS_SO_GET_DAEMON in do_ip_vs_get_ctl protected by sync_mutex instead of __ip_vs_mutex as sugested by Julian.

---
 include/net/ip_vs.h             |    1 +
 net/netfilter/ipvs/ip_vs_ctl.c  |  131 ++++++++++++++++++++++++---------------
 net/netfilter/ipvs/ip_vs_sync.c |    6 ++
 3 files changed, 87 insertions(+), 51 deletions(-)
include/net/ip_vs.h +1 -0
index 1aaf915..8fa4430 100644
@@ -900,6 +900,7 @@ struct netns_ipvs {
 	volatile int		sync_state;
 	volatile int		master_syncid;
 	volatile int		backup_syncid;
+	struct mutex		sync_mutex;
 	/* multicast interface name */
 	char			master_mcast_ifn[IP_VS_IFNAME_MAXLEN];
 	char			backup_mcast_ifn[IP_VS_IFNAME_MAXLEN];
net/netfilter/ipvs/ip_vs_ctl.c +80 -51

206 lines not on this page · raw message

net/netfilter/ipvs/ip_vs_sync.c +6 -0
index 7ee7215..3cdd479 100644
@@ -61,6 +61,7 @@
 
 #define SYNC_PROTO_VER  1		/* Protocol version in header */
 
+static struct lock_class_key __ipvs_sync_key;
 /*
  *	IPVS sync connection entry
  *	Version 0, i.e. original version.
@@ -1545,6 +1546,7 @@ int start_sync_thread(struct net *net, int state, char *mcast_ifn, __u8 syncid)
 	IP_VS_DBG(7, "Each ip_vs_sync_conn entry needs %Zd bytes\n",
 		  sizeof(struct ip_vs_sync_conn_v0));
 
+
 	if (state == IP_VS_STATE_MASTER) {
 		if (ipvs->master_thread)
 			return -EEXIST;
@@ -1667,6 +1669,7 @@ int __net_init ip_vs_sync_net_init(struct net *net)
 {
 	struct netns_ipvs *ipvs = net_ipvs(net);
 
+	__mutex_init(&ipvs->sync_mutex, "ipvs->sync_mutex", &__ipvs_sync_key);
 	INIT_LIST_HEAD(&ipvs->sync_queue);
 	spin_lock_init(&ipvs->sync_lock);
 	spin_lock_init(&ipvs->sync_buff_lock);
@@ -1680,7 +1683,9 @@ int __net_init ip_vs_sync_net_init(struct net *net)
 void ip_vs_sync_net_cleanup(struct net *net)
 {
 	int retc;
+	struct netns_ipvs *ipvs = net_ipvs(net);
 
+	mutex_lock(&ipvs->sync_mutex);
 	retc = stop_sync_thread(net, IP_VS_STATE_MASTER);
 	if (retc && retc != -ESRCH)
 		pr_err("Failed to stop Master Daemon\n");
@@ -1688,4 +1693,5 @@ void ip_vs_sync_net_cleanup(struct net *net)
 	retc = stop_sync_thread(net, IP_VS_STATE_BACKUP);
 	if (retc && retc != -ESRCH)
 		pr_err("Failed to stop Backup Daemon\n");
+	mutex_unlock(&ipvs->sync_mutex);
 }
Signature · 1 line
1.7.2.5
maintainer
#3 lore raw
In reply to [email protected]

From: [email protected]
Date: Wed, 12 Oct 2011 19:32:50 +0200

Quoted 4 lines

From: Pablo Neira Ayuso <[email protected]>

Hi Dave,

Quoted 8 lines

The following patches are two bugfixes for your net tree. One regarding the conntrack event infrastructure with GRE traffic and one fix to resolve one deadlock in the IPVS state synchronization.

You can pull these changes from (my nf branch):

git://1984.lsi.us.es/net nf

Thanks Pablo, I'll pull this as soon as Linus takes in my most recent pull request. I don't want new changes appearing in my tree outside of those I told him would be there in my pull request, that tends to upset him. :-)

maintainer
#4 lore raw
In reply to [email protected]

From: [email protected]
Date: Wed, 12 Oct 2011 19:32:50 +0200

Quoted 8 lines

The following patches are two bugfixes for your net tree. One regarding the conntrack event infrastructure with GRE traffic and one fix to resolve one deadlock in the IPVS state synchronization.

You can pull these changes from (my nf branch):

git://1984.lsi.us.es/net nf

All pulled, thanks Pablo.