Skip to contentSkip to conversation

Future changes

PATCH In review Julian Anastasov 2 participants 6 messages Sep 12, 2013 – Sep 20, 2013

Subsystems (4)
lore
Share & tools
lore

Julian Anastasov

author maintainer
#0 lore raw

v2 cover Future changes

This patchset contains my pending patches when
net-next opens. While first patch does not depend on
recent commits, the second patch depends on some fixes
we will add after 3.12: "ipvs: make the service replacement more robust". So, the second patch should wait some -rc releases.
I'll resend it later if needed.

Julian Anastasov (2):
ipvs: fix the IPVS_CMD_ATTR_MAX definition
ipvs: avoid rcu_barrier during netns cleanup

 include/net/ip_vs.h              |    6 ++++++
 include/uapi/linux/ip_vs.h       |    2 +-
 net/netfilter/ipvs/ip_vs_ctl.c   |    6 +-----
 net/netfilter/ipvs/ip_vs_lblc.c  |    2 +-
 net/netfilter/ipvs/ip_vs_lblcr.c |    2 +-
 5 files changed, 10 insertions(+), 8 deletions(-)
Signature · 1 line
1.7.3.4
author maintainer
#1 lore raw

PATCH v2 1/2 ipvs: fix the IPVS_CMD_ATTR_MAX definition

It was wrong (bigger) but problem is harmless.

---
 include/uapi/linux/ip_vs.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/uapi/linux/ip_vs.h +1 -1
index 2945822..fbcffe8 100644
@@ -334,7 +334,7 @@ enum {
 	__IPVS_CMD_ATTR_MAX,
 };
 
-#define IPVS_CMD_ATTR_MAX (__IPVS_SVC_ATTR_MAX - 1)
+#define IPVS_CMD_ATTR_MAX (__IPVS_CMD_ATTR_MAX - 1)
 
 /*
  * Attributes used to describe a service
Signature · 1 line
1.7.3.4
maintainer
#2 lore raw

Re: [PATCHv2 net-next 1/2] ipvs: fix the IPVS_CMD_ATTR_MAX definition

Quoted 3 lines · Julian Anastasov

It was wrong (bigger) but problem is harmless.

Thanks, I have this in ipvs-next but have been very slow sending it. And as I am currently on an aeroplane its a bit hard to prepare a tag for a pull request right now. I will do so soon.

Quoted 25 lines
---
 include/uapi/linux/ip_vs.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/uapi/linux/ip_vs.h +1 -1
index 2945822..fbcffe8 100644
@@ -334,7 +334,7 @@ enum {
 	__IPVS_CMD_ATTR_MAX,
 };
 
-#define IPVS_CMD_ATTR_MAX (__IPVS_SVC_ATTR_MAX - 1)
+#define IPVS_CMD_ATTR_MAX (__IPVS_CMD_ATTR_MAX - 1)
 
 /*
  * Attributes used to describe a service
Signature · 6 lines
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe lvs-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#3 lore raw

PATCH v2 2/2 ipvs: avoid rcu_barrier during netns cleanup

In reply to Julian Anastasov

commit 578bc3ef1e473a ("ipvs: reorganize dest trash") added rcu_barrier() on cleanup to wait dest users and schedulers like LBLC and LBLCR to put their last dest reference. Using rcu_barrier with many namespaces is problematic.

Trying to fix it by freeing dest with kfree_rcu is not a solution, RCU callbacks can run in parallel and execution order is random.

Fix it by creating new function ip_vs_dest_put_and_free() which is heavier than ip_vs_dest_put(). We will use it just for schedulers like LBLC, LBLCR that can delay their dest release.

By default, dests reference is above 0 if they are present in service and it is 0 when deleted but still in trash list. Change the dest trash code to use ip_vs_dest_put_and_free(), so that refcnt -1 can be used for freeing. As result, such checks remain in slow path and the rcu_barrier() from netns cleanup can be removed.

---
 include/net/ip_vs.h              |    6 ++++++
 net/netfilter/ipvs/ip_vs_ctl.c   |    6 +-----
 net/netfilter/ipvs/ip_vs_lblc.c  |    2 +-
 net/netfilter/ipvs/ip_vs_lblcr.c |    2 +-
 4 files changed, 9 insertions(+), 7 deletions(-)
include/net/ip_vs.h +6 -0
index c32360d..7a33897 100644
@@ -1446,6 +1446,12 @@ static inline void ip_vs_dest_put(struct ip_vs_dest *dest)
 	atomic_dec(&dest->refcnt);
 }
 
+static inline void ip_vs_dest_put_and_free(struct ip_vs_dest *dest)
+{
+	if (atomic_dec_return(&dest->refcnt) < 0)
+		kfree(dest);
+}
+
 /*
  *      IPVS sync daemon data and function prototypes
  *      (from ip_vs_sync.c)
net/netfilter/ipvs/ip_vs_ctl.c +1 -5
index a3df9bd..62786a4 100644
@@ -704,7 +704,7 @@ static void ip_vs_dest_free(struct ip_vs_dest *dest)
 	__ip_vs_dst_cache_reset(dest);
 	__ip_vs_svc_put(svc, false);
 	free_percpu(dest->stats.cpustats);
-	kfree(dest);
+	ip_vs_dest_put_and_free(dest);
 }
 
 /*
@@ -3820,10 +3820,6 @@ void __net_exit ip_vs_control_net_cleanup(struct net *net)
 {
 	struct netns_ipvs *ipvs = net_ipvs(net);
 
-	/* Some dest can be in grace period even before cleanup, we have to
-	 * defer ip_vs_trash_cleanup until ip_vs_dest_wait_readers is called.
-	 */
-	rcu_barrier();
 	ip_vs_trash_cleanup(net);
 	ip_vs_stop_estimator(net, &ipvs->tot_stats);
 	ip_vs_control_net_cleanup_sysctl(net);
net/netfilter/ipvs/ip_vs_lblc.c +1 -1
index b39b0e9..a81659d 100644
@@ -136,7 +136,7 @@ static void ip_vs_lblc_rcu_free(struct rcu_head *head)
 						   struct ip_vs_lblc_entry,
 						   rcu_head);
 
-	ip_vs_dest_put(en->dest);
+	ip_vs_dest_put_and_free(en->dest);
 	kfree(en);
 }
 
net/netfilter/ipvs/ip_vs_lblcr.c +1 -1
index 688f613..b6a024b 100644
@@ -130,7 +130,7 @@ static void ip_vs_lblcr_elem_rcu_free(struct rcu_head *head)
 	struct ip_vs_dest_set_elem *e;
 
 	e = container_of(head, struct ip_vs_dest_set_elem, rcu_head);
-	ip_vs_dest_put(e->dest);
+	ip_vs_dest_put_and_free(e->dest);
 	kfree(e);
 }
 
Signature · 1 line
1.7.3.4
maintainer
#4 lore raw
In reply to Julian Anastasov
Quoted 6 lines · Julian Anastasov

This patchset contains my pending patches when
net-next opens. While first patch does not depend on
recent commits, the second patch depends on some fixes
we will add after 3.12: "ipvs: make the service replacement more robust". So, the second patch should wait some -rc releases.
I'll resend it later if needed.

Please resent it once you would like it accepted.

author maintainer
#5 lore raw

Hello,

Quoted 9 lines · Simon Horman
Quoted 6 lines · Julian Anastasov

This patchset contains my pending patches when
net-next opens. While first patch does not depend on
recent commits, the second patch depends on some fixes
we will add after 3.12: "ipvs: make the service replacement more robust". So, the second patch should wait some -rc releases.
I'll resend it later if needed.

Please resent it once you would like it accepted.

That is what I'll do when net changes reach in net-next

Regards

--
Julian Anastasov <[email protected]>