[Devel] [PATCH RHEL7 COMMIT] vzprivnet: rt cache drop on vzprivnet update

Konstantin Khorenko khorenko at virtuozzo.com
Thu Mar 24 08:53:44 PDT 2016


The commit is pushed to "branch-rh7-3.10.0-327.10.1.vz7.12.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.10.1.vz7.12.3
------>
commit a8a54004b07a4930ebf03dda33a0ec1188ed2376
Author: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Date:   Thu Mar 24 19:53:44 2016 +0400

    vzprivnet: rt cache drop on vzprivnet update
    
    changes:
    1) fix rt_cache_flush arguments
    Below commit removes arg delay from rt_cache_flush:
    commit bafa6d9d8907 ("ipv4/route: arg delay is useless in
    rt_cache_flush()")
    
    Port diff-vzprivnet-rt-cache-drop-on-vzprivnet-update
      rt cache drop on vzprivnet update
    
      Vzprivnet update does not flushes rt cache inside containers. If entry
      was cached before update, vzprivnet changes can have no effect during
      quite long time.
    
      This patch flushes rt cache inside all containers after privnet changes.
      It guarantees that all newly created entries will have correct
      privnet_mark.
    
      https://jira.sw.ru/browse/PSBM-28881
    
      Signed-off-by: Vasily Averin <vvs at parallels.com>
    
    Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 net/ipv4/netfilter/ip_vzprivnet.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/netfilter/ip_vzprivnet.c b/net/ipv4/netfilter/ip_vzprivnet.c
index efe0d95..258d12c 100644
--- a/net/ipv4/netfilter/ip_vzprivnet.c
+++ b/net/ipv4/netfilter/ip_vzprivnet.c
@@ -480,6 +480,7 @@ static int parse_param(const char *param, int *add, u32 *net,
 static ssize_t vzpriv_write(struct file * file, const char __user *buf,
 			    size_t count, loff_t *ppos)
 {
+	struct net *net;
 	char *s, *page;
 	int err;
 	int offset;
@@ -495,8 +496,6 @@ static ssize_t vzpriv_write(struct file * file, const char __user *buf,
 	if (err)
 		goto err;
 
-	rt_cache_flush(&init_net);
-
 	s = page;
 	s[count] = 0;
 
@@ -520,6 +519,11 @@ static ssize_t vzpriv_write(struct file * file, const char __user *buf,
 		s = nextline(s);
 	}
 out:
+	rtnl_lock();
+	for_each_net(net)
+		rt_cache_flush(net);
+	rtnl_unlock();
+
 	offset = s - page;
 	if (offset > 0)
 		err = offset;
@@ -815,6 +819,7 @@ static int parse_sparse(const char *param, int *add,
 static ssize_t sparse_write(struct file * file, const char __user *buf,
 			    size_t count, loff_t *ppos)
 {
+	struct net *net;
 	char *s, *page;
 	int err;
 	int offset;
@@ -830,8 +835,6 @@ static ssize_t sparse_write(struct file * file, const char __user *buf,
 	if (err)
 		goto err;
 
-	rt_cache_flush(&init_net);
-
 	s = page;
 	s[count] = 0;
 
@@ -856,6 +859,11 @@ static ssize_t sparse_write(struct file * file, const char __user *buf,
 		s = nextline(s);
 	}
 out:
+	rtnl_lock();
+	for_each_net(net)
+		rt_cache_flush(net);
+	rtnl_unlock();
+
 	offset = s - page;
 	if (offset > 0)
 		err = offset;


More information about the Devel mailing list